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