ProfileTree.st
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 17 Feb 2021 15:24:09 +0100
branchjv
changeset 4568 524471ef6575
parent 4384 e28fcaaf93c7
permissions -rw-r--r--
Changing the encoding style header for fileOutAs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     1
"
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     3
	      All Rights Reserved
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     4
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     5
 This software is furnished under a license and may be used
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     6
 only in accordance with the terms of that license and with the
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     8
 be provided or otherwise made available to, or used by, any
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
     9
 other person.  No title to or ownership of the software is
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    10
 hereby transferred.
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    11
"
3965
a4d91c7d1e52 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
    12
"{ Package: 'stx:libbasic3' }"
24
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    13
3965
a4d91c7d1e52 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
    14
"{ NameSpace: Smalltalk }"
957
54dade11e57f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
    15
120
950e4628d657 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
    16
Object subclass:#ProfileTree
236
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    17
	instanceVariableNames:'receiver selector class leafTally totalTally called isBlock'
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    18
	classVariableNames:''
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    19
	poolDictionaries:''
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    20
	category:'System-Debugging-Support'
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    21
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    22
23
a85cd774be98 *** empty log message ***
claus
parents: 22
diff changeset
    23
!ProfileTree class methodsFor:'documentation'!
a85cd774be98 *** empty log message ***
claus
parents: 22
diff changeset
    24
24
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    25
copyright
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    26
"
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    27
 COPYRIGHT (c) 1995 by Claus Gittinger
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    28
	      All Rights Reserved
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    29
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    30
 This software is furnished under a license and may be used
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    31
 only in accordance with the terms of that license and with the
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    33
 be provided or otherwise made available to, or used by, any
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    34
 other person.  No title to or ownership of the software is
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    35
 hereby transferred.
10e1150b1f4b *** empty log message ***
claus
parents: 23
diff changeset
    36
"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    37
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    38
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    39
documentation
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    40
"
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    41
    This is is used as a companion to MessageTally.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    42
    Instances of it are used to represent a calling chain.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    43
    (MessageTally could have used the contexts themself, but these
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    44
     may create more overhead)
236
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    45
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    46
    [author:]
7f570e0a0a75 documentation
Claus Gittinger <cg@exept.de>
parents: 120
diff changeset
    47
        Claus Gittinger
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    48
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    49
    [see also:]
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    50
        MessageTally CallChain
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    51
        MessageTracer
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    52
        AbstractTime
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    53
"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    54
! !
2911230f8e8e Initial revision
claus
parents:
diff changeset
    55
2911230f8e8e Initial revision
claus
parents:
diff changeset
    56
!ProfileTree methodsFor:'accessing'!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    57
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    58
called
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    59
    "return the trees of the called methods/blocks"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    60
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    61
    ^ called
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    62
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    63
    "Modified: 18.5.1996 / 19:00:59 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    64
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    65
2911230f8e8e Initial revision
claus
parents:
diff changeset
    66
called:aCollection
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    67
    "set the trees of the called methods/blocks"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    68
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    69
    called := aCollection
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    70
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    71
    "Modified: 18.5.1996 / 19:01:08 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    72
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    73
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    74
isBlock 
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    75
    "return true, if this is a tree for a block-context"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    76
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    77
    ^ isBlock
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    78
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    79
    "Modified: 18.5.1996 / 18:59:12 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    80
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    81
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    82
leafTally
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    83
    "return true, if this is a leaf"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    84
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    85
    ^ leafTally
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    86
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    87
    "Modified: 18.5.1996 / 19:01:27 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    88
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    89
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    90
methodClass 
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    91
    "return the contexts methods class"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    92
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    93
    ^ class
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    94
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    95
    "Modified: 18.5.1996 / 19:01:40 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
    96
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
    97
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
    98
receiver
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    99
    "return the contexts receiver"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   100
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   101
    ^ receiver
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   102
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   103
    "Modified: 18.5.1996 / 19:01:45 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   104
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   105
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   106
receiver:r selector:s class:cls isBlock:blk
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   107
    "private tally interface - set receiver, selector, class
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   108
     and the block flag."
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   109
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   110
    receiver := r.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   111
    selector := s.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   112
    class := cls.
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   113
    isBlock := blk.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   114
    leafTally := totalTally := 0.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   115
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   116
    "Modified: 20.3.1997 / 20:46:19 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   117
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   118
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   119
selector 
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   120
    "return the contexts selector"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   121
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   122
    ^ selector
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   123
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   124
    "Modified: 18.5.1996 / 19:02:04 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   125
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   126
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   127
totalTally
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   128
    "return the total tally counter"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   129
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   130
    ^ totalTally
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   131
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   132
    "Modified: 18.5.1996 / 19:02:15 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   133
! !
2911230f8e8e Initial revision
claus
parents:
diff changeset
   134
2911230f8e8e Initial revision
claus
parents:
diff changeset
   135
!ProfileTree methodsFor:'adding info'!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   136
2911230f8e8e Initial revision
claus
parents:
diff changeset
   137
addChain:aCallChain
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   138
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   139
3965
a4d91c7d1e52 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
   140
    "merge a chain into the receiver's tree"
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   141
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   142
    |node found subTree chain called|
2911230f8e8e Initial revision
claus
parents:
diff changeset
   143
2911230f8e8e Initial revision
claus
parents:
diff changeset
   144
    node := self.
2911230f8e8e Initial revision
claus
parents:
diff changeset
   145
    chain := aCallChain.
2911230f8e8e Initial revision
claus
parents:
diff changeset
   146
2911230f8e8e Initial revision
claus
parents:
diff changeset
   147
    [chain notNil] whileTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   148
        node incrementTotalTally.
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   149
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   150
        found := false.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   151
        (called := node called) notNil ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   152
            called do:[:subTree |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   153
                found ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   154
                    (chain = subTree) ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   155
                        node := subTree.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   156
                        chain := chain rest.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   157
                        found := true
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   158
                    ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   159
                ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   160
            ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   161
        ] ifFalse:[
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   162
            node called:(called := OrderedCollection new)
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   163
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   164
        found ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   165
            subTree := ProfileTree new.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   166
            subTree receiver:chain receiver
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   167
                    selector:chain selector
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   168
                       class:chain methodClass
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   169
                     isBlock:chain isBlock.
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   170
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   171
            called add:subTree.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   172
            node := subTree.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   173
            chain := chain rest
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   174
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   175
    ].
2911230f8e8e Initial revision
claus
parents:
diff changeset
   176
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   177
    node incrementTotalAndLeafTally.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   178
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   179
    "Modified: 20.3.1997 / 20:45:50 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   180
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   181
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   182
computePercentage:total
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   183
    "compute percentages"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   184
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   185
    totalTally := (totalTally / total * 1000) rounded / 10.0.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   186
    leafTally notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   187
        leafTally := (leafTally / total * 1000) rounded / 10.0
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   188
    ].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   189
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   190
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   191
        called do:[:subTree |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   192
            subTree computePercentage:total
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   193
        ]
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   194
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   195
566
3a1da38772f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   196
    "Modified: 20.3.1997 / 21:32:01 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   197
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   198
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   199
incrementLeafTally
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   200
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   201
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   202
    "count as leaf"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   203
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   204
    leafTally := leafTally + 1.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   205
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   206
    "Modified: 20.3.1997 / 20:46:27 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   207
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   208
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   209
incrementTotalAndLeafTally
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   210
    "{ Pragma: +optSpeed }"
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   211
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   212
    "count as leaf and total"
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   213
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   214
    leafTally := leafTally + 1.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   215
    totalTally := totalTally + 1.
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   216
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   217
    "Modified: 20.3.1997 / 20:46:36 / cg"
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   218
!
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   219
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   220
incrementTotalTally
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   221
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   222
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   223
    "count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   224
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   225
    totalTally := totalTally + 1.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   226
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   227
    "Modified: 20.3.1997 / 20:46:41 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   228
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   229
2911230f8e8e Initial revision
claus
parents:
diff changeset
   230
leafTally:aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   231
    "set the leafTally count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   232
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   233
    leafTally := aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   234
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   235
    "Modified: 18.5.1996 / 19:03:22 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   236
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   237
2911230f8e8e Initial revision
claus
parents:
diff changeset
   238
totalTally:aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   239
    "set the totalTally count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   240
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   241
    totalTally := aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   242
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   243
    "Modified: 18.5.1996 / 19:03:30 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   244
! !
2911230f8e8e Initial revision
claus
parents:
diff changeset
   245
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   246
!ProfileTree methodsFor:'prettyPrinting'!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   247
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   248
printLeafsOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   249
    "print all leafNodes statistics on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   250
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   251
    |leafNodes|
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   252
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   253
    leafNodes := OrderedCollection new.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   254
    self addLeafNodesTo:leafNodes.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   255
    leafNodes := leafNodes asSortedCollection:[:a :b |
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   256
                                        a leafTally < b leafTally].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   257
    leafNodes do:[:aNode |
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   258
        aNode leafTally ~= 0 ifTrue:[
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   259
            aNode printSingleLeafOn:aStream.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   260
            aStream cr.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   261
        ]
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   262
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   263
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   264
    "Modified: 20.3.1997 / 21:08:09 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   265
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   266
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   267
printMethodLeafsOn:aStream
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   268
    "print all method leafNodes statistics on aStream"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   269
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   270
    |leafNodes|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   271
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   272
    leafNodes := OrderedCollection new.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   273
    self addMethodLeafNodesTo:leafNodes.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   274
    leafNodes := leafNodes asSortedCollection:[:a :b |
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   275
                                        a leafTally < b leafTally].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   276
    leafNodes do:[:aNode |
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   277
        aNode leafTally ~= 0 ifTrue:[
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   278
            aNode printSingleMethodLeafOn:aStream.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   279
            aStream cr.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   280
        ].
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   281
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   282
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   283
    "Created: 19.3.1997 / 12:19:31 / cg"
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   284
    "Modified: 20.3.1997 / 21:07:39 / cg"
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   285
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   286
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   287
printOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   288
    "print statistics on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   289
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   290
    |s|
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   291
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   292
"/    self printOn:aStream indent:0
4099
42f9eaeea092 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3965
diff changeset
   293
    s := WriteStream on:''.
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   294
    self printOn:s indent:0.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   295
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   296
    aStream nextPutAll:s contents
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   297
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   298
    "Modified: 18.5.1996 / 19:03:55 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   299
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   300
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   301
printOn:aStream indent:i
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   302
    "print statistics indented on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   303
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   304
    selector notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   305
        aStream spaces:i.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   306
        self printSingleOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   307
        aStream cr.
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   308
    ].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   309
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   310
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   311
        called do:[:sub|
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   312
            sub printOn:aStream indent:(i + 1)
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   313
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   314
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   315
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   316
    "Modified: 18.5.1996 / 19:04:12 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   317
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   318
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   319
printSingleLeafOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   320
    "print a single nodes statistic on aStream"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   321
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   322
    selector notNil ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   323
        isBlock == true ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   324
            '[] in ' printOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   325
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   326
        receiver name printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   327
        (class notNil and:[class ~~ receiver]) ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   328
            '>>' printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   329
            class name printOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   330
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   331
        aStream space.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   332
        selector printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   333
        aStream space.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   334
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   335
        leafTally notNil ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   336
            aStream nextPutAll:'('.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   337
            leafTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   338
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   339
        ] ifFalse:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   340
            aStream nextPutAll:'(total '.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   341
            totalTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   342
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   343
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   344
    ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   345
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   346
    "Created: 19.3.1997 / 19:10:13 / cg"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   347
    "Modified: 19.3.1997 / 19:17:05 / cg"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   348
!
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   349
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   350
printSingleMethodLeafOn:aStream
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   351
    "print a single nodes statistic on aStream"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   352
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   353
    |cls|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   354
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   355
    selector notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   356
        isBlock == true ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   357
            '[] in ' printOn:aStream
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   358
        ].
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   359
        (class notNil and:[class ~~ receiver]) ifTrue:[
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   360
            cls := class
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   361
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   362
            cls := receiver.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   363
        ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   364
        cls name printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   365
        aStream space.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   366
        selector printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   367
        aStream space.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   368
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   369
        leafTally notNil ifTrue:[
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   370
            aStream nextPutAll:'('.
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   371
            leafTally printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   372
            aStream nextPutAll:'%)'.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   373
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   374
            aStream nextPutAll:'(total '.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   375
            totalTally printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   376
            aStream nextPutAll:'%)'.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   377
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   378
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   379
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   380
    "Created: 19.3.1997 / 19:10:32 / cg"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   381
    "Modified: 19.3.1997 / 19:17:13 / cg"
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   382
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   383
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   384
printSingleOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   385
    "print a single nodes statistic on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   386
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   387
    selector notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   388
        isBlock == true ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   389
            '[] in ' printOn:aStream
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   390
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   391
        receiver name printOn:aStream.
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   392
        (class notNil and:[class ~~ receiver]) ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   393
            '>>' printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   394
            class name printOn:aStream
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   395
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   396
        aStream space.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   397
        selector printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   398
        aStream space.
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   399
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   400
        (leafTally isNil or:[leafTally ~= totalTally]) ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   401
            aStream nextPutAll:'(total '.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   402
            totalTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   403
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   404
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   405
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   406
        leafTally notNil ifTrue:[
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   407
            aStream nextPutAll:'(here '.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   408
            leafTally printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   409
            aStream nextPutAll:'%)'.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   410
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   411
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   412
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   413
    "Modified: 19.3.1997 / 19:14:32 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   414
! !
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   415
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   416
!ProfileTree methodsFor:'private'!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   417
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   418
= aProfileTreeNode
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   419
    "return true, if the argument tree is for the same method invocation"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   420
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   421
    selector ~~ aProfileTreeNode selector ifTrue:[^ false].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   422
    class ~~ aProfileTreeNode methodClass ifTrue:[^ false].
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   423
    receiver ~= aProfileTreeNode receiver ifTrue:[^ false].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   424
    ^ true
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   425
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   426
    "Modified: 19.3.1997 / 12:23:41 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   427
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   428
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   429
addLeafNodesTo:aCollection
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   430
    "add all leaf nodes to aCollection"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   431
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   432
    |idx|
2911230f8e8e Initial revision
claus
parents:
diff changeset
   433
2911230f8e8e Initial revision
claus
parents:
diff changeset
   434
    leafTally notNil ifTrue:[
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   435
        idx := aCollection indexOf:self.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   436
        idx == 0 ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   437
            aCollection add:self copy
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   438
        ] ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   439
            |nd|
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   440
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   441
            nd := aCollection at:idx.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   442
            nd leafTally:(nd leafTally + leafTally).
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   443
            nd totalTally:(nd totalTally max: totalTally)
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   444
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   445
    ].
2911230f8e8e Initial revision
claus
parents:
diff changeset
   446
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   447
        called do:[:aNode |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   448
            aNode addLeafNodesTo:aCollection
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   449
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   450
    ]
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   451
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   452
    "Modified: 19.3.1997 / 12:23:49 / cg"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   453
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   454
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   455
addMethodLeafNodesTo:aCollection
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   456
    "add all method leaf nodes to aCollection"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   457
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   458
    |idx|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   459
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   460
    leafTally notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   461
        idx := aCollection findFirst:[:el | el sameMethodAsIn:self].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   462
        idx == 0 ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   463
            aCollection add:self copy
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   464
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   465
            |nd|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   466
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   467
            nd := aCollection at:idx.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   468
            nd leafTally:(nd leafTally + leafTally).
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   469
            nd totalTally:(nd totalTally max: totalTally)
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   470
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   471
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   472
    called notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   473
        called do:[:aNode |
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   474
            aNode addMethodLeafNodesTo:aCollection
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   475
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   476
    ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   477
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   478
    "Modified: 19.3.1997 / 12:26:05 / cg"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   479
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   480
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   481
hash
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   482
    "return true, if the argument tree is for the same method invocation"
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   483
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   484
    class notNil ifTrue:[
568
a92fa92a97d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   485
        ^ selector identityHash bitXor: class identityHash
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   486
    ].
568
a92fa92a97d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   487
    ^ selector identityHash bitXor: receiver identityHash
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   488
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   489
    "Created: 20.3.1997 / 20:27:15 / cg"
568
a92fa92a97d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   490
    "Modified: 21.3.1997 / 14:02:27 / cg"
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   491
!
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   492
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   493
sameMethodAsIn:aProfileTreeNode
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   494
    "return true, if the argument tree is for the same method invocation"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   495
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   496
    selector ~~ aProfileTreeNode selector ifTrue:[^ false].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   497
    class ~~ aProfileTreeNode methodClass ifTrue:[^ false].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   498
    ^ true
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   499
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   500
    "Created: 19.3.1997 / 12:23:24 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   501
! !
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   502
98
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   503
!ProfileTree class methodsFor:'documentation'!
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   504
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   505
version
3965
a4d91c7d1e52 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
   506
    ^ '$Header$'
3121
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   507
!
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   508
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   509
version_HG
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   510
19723298dd2c Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3042
diff changeset
   511
    ^ '$Changeset: <not expanded> $'
3012
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   512
!
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   513
4f40b8304d54 Added InvalidChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3011
diff changeset
   514
version_SVN
3970
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3128 3965
diff changeset
   515
    ^ 'Id: ProfileTree.st 1909 2012-03-31 00:14:49Z vranyj1 '
98
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   516
! !
3965
a4d91c7d1e52 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
   517