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