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