ProfileTree.st
author Claus Gittinger <cg@exept.de>
Thu, 20 Mar 1997 21:47:08 +0100
changeset 566 3a1da38772f9
parent 563 f4476ed0134f
child 568 a92fa92a97d4
permissions -rw-r--r--
checkin from browser
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
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   103
receiver:r selector:s class:cls isBlock:blk
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   104
    "private tally interface - set receiver, selector, class
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   105
     and the block flag."
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   106
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   107
    receiver := r.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   108
    selector := s.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   109
    class := cls.
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   110
    isBlock := blk.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   111
    leafTally := totalTally := 0.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   112
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   113
    "Modified: 20.3.1997 / 20:46:19 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   114
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   115
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   116
selector 
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   117
    "return the contexts selector"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
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
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   121
    "Modified: 18.5.1996 / 19:02:04 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   122
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   123
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   124
totalTally
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   125
    "return the total tally counter"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
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
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   129
    "Modified: 18.5.1996 / 19:02:15 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   130
! !
2911230f8e8e Initial revision
claus
parents:
diff changeset
   131
2911230f8e8e Initial revision
claus
parents:
diff changeset
   132
!ProfileTree methodsFor:'adding info'!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   133
2911230f8e8e Initial revision
claus
parents:
diff changeset
   134
addChain:aCallChain
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   135
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   136
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   137
    "merge a chain into the receivers tree"
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   138
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   139
    |node found subTree chain called|
2911230f8e8e Initial revision
claus
parents:
diff changeset
   140
2911230f8e8e Initial revision
claus
parents:
diff changeset
   141
    node := self.
2911230f8e8e Initial revision
claus
parents:
diff changeset
   142
    chain := aCallChain.
2911230f8e8e Initial revision
claus
parents:
diff changeset
   143
2911230f8e8e Initial revision
claus
parents:
diff changeset
   144
    [chain notNil] whileTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   145
        node incrementTotalTally.
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   146
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   147
        found := false.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   148
        (called := node called) notNil ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   149
            called do:[:subTree |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   150
                found ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   151
                    (chain = subTree) ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   152
                        node := subTree.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   153
                        chain := chain rest.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   154
                        found := true
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   155
                    ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   156
                ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   157
            ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   158
        ] ifFalse:[
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   159
            node called:(called := OrderedCollection new)
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   160
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   161
        found ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   162
            subTree := ProfileTree new.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   163
            subTree receiver:chain receiver
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   164
                    selector:chain selector
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   165
                       class:chain methodClass
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   166
                     isBlock:chain isBlock.
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   167
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   168
            called add:subTree.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   169
            node := subTree.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   170
            chain := chain rest
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   171
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   172
    ].
2911230f8e8e Initial revision
claus
parents:
diff changeset
   173
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   174
    node incrementTotalAndLeafTally.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   175
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   176
    "Modified: 20.3.1997 / 20:45:50 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   177
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   178
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   179
computePercentage:total
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   180
    "compute percentages"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   181
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   182
    totalTally := (totalTally / total * 1000) rounded / 10.0.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   183
    leafTally notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   184
        leafTally := (leafTally / total * 1000) rounded / 10.0
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   185
    ].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   186
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   187
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   188
        called do:[:subTree |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   189
            subTree computePercentage:total
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   190
        ]
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   191
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   192
566
3a1da38772f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   193
    "Modified: 20.3.1997 / 21:32:01 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   194
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   195
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   196
incrementLeafTally
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   197
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   198
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   199
    "count as leaf"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   200
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   201
    leafTally := leafTally + 1.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   202
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   203
    "Modified: 20.3.1997 / 20:46:27 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   204
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   205
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   206
incrementTotalAndLeafTally
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   207
    "{ Pragma: +optSpeed }"
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   208
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   209
    "count as leaf and total"
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   210
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   211
    leafTally := leafTally + 1.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   212
    totalTally := totalTally + 1.
562
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
    "Modified: 20.3.1997 / 20:46:36 / cg"
562
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   215
!
62a29d76057e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
   216
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   217
incrementTotalTally
263
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   218
    "{ Pragma: +optSpeed }"
4c3889934577 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 261
diff changeset
   219
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   220
    "count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   221
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   222
    totalTally := totalTally + 1.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   223
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   224
    "Modified: 20.3.1997 / 20:46:41 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   225
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   226
2911230f8e8e Initial revision
claus
parents:
diff changeset
   227
leafTally:aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   228
    "set the leafTally count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   229
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   230
    leafTally := aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   231
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   232
    "Modified: 18.5.1996 / 19:03:22 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   233
!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   234
2911230f8e8e Initial revision
claus
parents:
diff changeset
   235
totalTally:aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   236
    "set the totalTally count"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   237
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   238
    totalTally := aCount
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   239
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   240
    "Modified: 18.5.1996 / 19:03:30 / cg"
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   241
! !
2911230f8e8e Initial revision
claus
parents:
diff changeset
   242
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   243
!ProfileTree methodsFor:'prettyPrinting'!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   244
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   245
printLeafsOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   246
    "print all leafNodes statistics on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   247
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   248
    |leafNodes|
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   249
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   250
    leafNodes := OrderedCollection new.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   251
    self addLeafNodesTo:leafNodes.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   252
    leafNodes := leafNodes asSortedCollection:[:a :b |
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   253
                                        a leafTally < b leafTally].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   254
    leafNodes do:[:aNode |
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   255
        aNode leafTally ~= 0 ifTrue:[
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   256
            aNode printSingleLeafOn:aStream.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   257
            aStream cr.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   258
        ]
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   259
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   260
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   261
    "Modified: 20.3.1997 / 21:08:09 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   262
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   263
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   264
printMethodLeafsOn:aStream
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   265
    "print all method leafNodes statistics on aStream"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   266
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   267
    |leafNodes|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   268
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   269
    leafNodes := OrderedCollection new.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   270
    self addMethodLeafNodesTo:leafNodes.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   271
    leafNodes := leafNodes asSortedCollection:[:a :b |
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   272
                                        a leafTally < b leafTally].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   273
    leafNodes do:[:aNode |
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   274
        aNode leafTally ~= 0 ifTrue:[
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   275
            aNode printSingleMethodLeafOn:aStream.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   276
            aStream cr.
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   277
        ].
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   278
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   279
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   280
    "Created: 19.3.1997 / 12:19:31 / cg"
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   281
    "Modified: 20.3.1997 / 21:07:39 / cg"
559
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
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   284
printOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   285
    "print statistics on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   286
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   287
    |s|
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   288
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   289
"/    self printOn:aStream indent:0
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   290
    s := WriteStream on:String new.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   291
    self printOn:s indent:0.
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   292
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   293
    aStream nextPutAll:s contents
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   294
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   295
    "Modified: 18.5.1996 / 19:03:55 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   296
!
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
printOn:aStream indent:i
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   299
    "print statistics indented on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   300
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   301
    selector notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   302
        aStream spaces:i.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   303
        self printSingleOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   304
        aStream cr.
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   305
    ].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   306
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   307
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   308
        called do:[:sub|
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   309
            sub printOn:aStream indent:(i + 1)
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   310
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   311
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   312
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   313
    "Modified: 18.5.1996 / 19:04:12 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   314
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   315
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   316
printSingleLeafOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   317
    "print a single nodes statistic on aStream"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   318
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   319
    selector notNil ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   320
        isBlock == true ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   321
            '[] in ' printOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   322
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   323
        receiver name printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   324
        (class notNil and:[class ~~ receiver]) ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   325
            '>>' printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   326
            class name printOn:aStream
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   327
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   328
        aStream space.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   329
        selector printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   330
        aStream space.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   331
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   332
        leafTally notNil ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   333
            aStream nextPutAll:'('.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   334
            leafTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   335
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   336
        ] ifFalse:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   337
            aStream nextPutAll:'(total '.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   338
            totalTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   339
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   340
        ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   341
    ].
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   342
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   343
    "Created: 19.3.1997 / 19:10:13 / cg"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   344
    "Modified: 19.3.1997 / 19:17:05 / cg"
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
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   347
printSingleMethodLeafOn:aStream
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   348
    "print a single nodes statistic on aStream"
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
    |cls|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   351
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   352
    selector notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   353
        isBlock == true ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   354
            '[] in ' printOn:aStream
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   355
        ].
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   356
        (class notNil and:[class ~~ receiver]) ifTrue:[
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   357
            cls := class
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   358
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   359
            cls := receiver.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   360
        ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   361
        cls name printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   362
        aStream space.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   363
        selector printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   364
        aStream space.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   365
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   366
        leafTally notNil ifTrue:[
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   367
            aStream nextPutAll:'('.
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   368
            leafTally printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   369
            aStream nextPutAll:'%)'.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   370
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   371
            aStream nextPutAll:'(total '.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   372
            totalTally printOn:aStream.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   373
            aStream nextPutAll:'%)'.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   374
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   375
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   376
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   377
    "Created: 19.3.1997 / 19:10:32 / cg"
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   378
    "Modified: 19.3.1997 / 19:17:13 / cg"
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   379
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   380
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   381
printSingleOn:aStream
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   382
    "print a single nodes statistic on aStream"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   383
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   384
    selector notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   385
        isBlock == true ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   386
            '[] in ' printOn:aStream
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   387
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   388
        receiver name printOn:aStream.
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   389
        (class notNil and:[class ~~ receiver]) ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   390
            '>>' printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   391
            class name printOn:aStream
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   392
        ].
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   393
        aStream space.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   394
        selector printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   395
        aStream space.
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   396
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   397
        (leafTally isNil or:[leafTally ~= totalTally]) ifTrue:[
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   398
            aStream nextPutAll:'(total '.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   399
            totalTally printOn:aStream.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   400
            aStream nextPutAll:'%)'.
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   401
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   402
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   403
        leafTally notNil ifTrue:[
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   404
            aStream nextPutAll:'(here '.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   405
            leafTally printOn:aStream.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   406
            aStream nextPutAll:'%)'.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   407
        ].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   408
    ].
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   409
560
50dc521a1a1d better printOut.
Claus Gittinger <cg@exept.de>
parents: 559
diff changeset
   410
    "Modified: 19.3.1997 / 19:14:32 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   411
! !
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   412
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   413
!ProfileTree methodsFor:'private'!
2911230f8e8e Initial revision
claus
parents:
diff changeset
   414
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   415
= aProfileTreeNode
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   416
    "return true, if the argument tree is for the same method invocation"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   417
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   418
    selector ~~ aProfileTreeNode selector ifTrue:[^ false].
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   419
    class ~~ aProfileTreeNode methodClass ifTrue:[^ false].
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   420
    receiver ~= aProfileTreeNode receiver ifTrue:[^ false].
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   421
    ^ true
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   422
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   423
    "Modified: 19.3.1997 / 12:23:41 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   424
!
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   425
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   426
addLeafNodesTo:aCollection
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   427
    "add all leaf nodes to aCollection"
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   428
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   429
    |idx|
2911230f8e8e Initial revision
claus
parents:
diff changeset
   430
2911230f8e8e Initial revision
claus
parents:
diff changeset
   431
    leafTally notNil ifTrue:[
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   432
        idx := aCollection indexOf:self.
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   433
        idx == 0 ifTrue:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   434
            aCollection add:self copy
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   435
        ] ifFalse:[
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   436
            |nd|
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   437
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   438
            nd := aCollection at:idx.
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   439
            nd leafTally:(nd leafTally + leafTally).
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   440
            nd totalTally:(nd totalTally max: totalTally)
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   441
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   442
    ].
2911230f8e8e Initial revision
claus
parents:
diff changeset
   443
    called notNil ifTrue:[
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   444
        called do:[:aNode |
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   445
            aNode addLeafNodesTo:aCollection
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   446
        ]
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   447
    ]
261
2fb596a13d0c commentary
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   448
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   449
    "Modified: 19.3.1997 / 12:23:49 / cg"
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   450
!
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   451
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   452
addMethodLeafNodesTo:aCollection
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   453
    "add all method leaf nodes to aCollection"
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
    |idx|
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
    leafTally notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   458
        idx := aCollection findFirst:[:el | el sameMethodAsIn:self].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   459
        idx == 0 ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   460
            aCollection add:self copy
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   461
        ] ifFalse:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   462
            |nd|
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   463
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   464
            nd := aCollection at:idx.
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   465
            nd leafTally:(nd leafTally + leafTally).
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   466
            nd totalTally:(nd totalTally max: totalTally)
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   467
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   468
    ].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   469
    called notNil ifTrue:[
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   470
        called do:[:aNode |
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   471
            aNode addMethodLeafNodesTo:aCollection
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   472
        ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   473
    ]
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   474
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   475
    "Modified: 19.3.1997 / 12:26:05 / cg"
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
563
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   478
hash
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   479
    "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
   480
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   481
    class notNil ifTrue:[
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   482
        ^ selector identityHash + class identityHash
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
    ^ selector identityHash + receiver identityHash
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   485
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   486
    "Created: 20.3.1997 / 20:27:15 / cg"
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   487
!
f4476ed0134f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 562
diff changeset
   488
559
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   489
sameMethodAsIn:aProfileTreeNode
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   490
    "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
   491
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   492
    selector ~~ aProfileTreeNode selector ifTrue:[^ false].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   493
    class ~~ aProfileTreeNode methodClass ifTrue:[^ false].
8015fde9ae16 better summary display
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   494
    ^ true
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
    "Created: 19.3.1997 / 12:23:24 / cg"
88
070ba8eb911e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 68
diff changeset
   497
! !
22
2911230f8e8e Initial revision
claus
parents:
diff changeset
   498
98
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   499
!ProfileTree class methodsFor:'documentation'!
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   500
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   501
version
566
3a1da38772f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 563
diff changeset
   502
    ^ '$Header: /cvs/stx/stx/libbasic3/ProfileTree.st,v 1.18 1997-03-20 20:47:08 cg Exp $'
98
123d948aacd1 version at the end
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
   503
! !