Tools__ProfilerInfoItem.st
changeset 9993 3dec934db707
child 10059 6fe87cce6a78
equal deleted inserted replaced
9992:174bd22eaad5 9993:3dec934db707
       
     1 "
       
     2  COPYRIGHT (c) 2006 by eXept Software AG
       
     3 	      All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 "{ Package: 'stx:libtool' }"
       
    13 
       
    14 "{ NameSpace: Tools }"
       
    15 
       
    16 HierarchicalItem subclass:#ProfilerInfoItem
       
    17 	instanceVariableNames:'method isBlock tally'
       
    18 	classVariableNames:''
       
    19 	poolDictionaries:''
       
    20 	category:'Interface-Browsers-New-Profiler'
       
    21 !
       
    22 
       
    23 !ProfilerInfoItem class methodsFor:'documentation'!
       
    24 
       
    25 copyright
       
    26 "
       
    27  COPYRIGHT (c) 2006 by eXept Software AG
       
    28 	      All Rights Reserved
       
    29 
       
    30  This software is furnished under a license and may be used
       
    31  only in accordance with the terms of that license and with the
       
    32  inclusion of the above copyright notice.   This software may not
       
    33  be provided or otherwise made available to, or used by, any
       
    34  other person.  No title to or ownership of the software is
       
    35  hereby transferred.
       
    36 "
       
    37 ! !
       
    38 
       
    39 !ProfilerInfoItem methodsFor:'accessing'!
       
    40 
       
    41 isBlock
       
    42     ^ isBlock ? false
       
    43 
       
    44     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
    45     "Modified: / 01-12-2007 / 23:54:48 / janfrog"
       
    46 !
       
    47 
       
    48 isBlock:aBoolean
       
    49     isBlock := aBoolean.
       
    50 
       
    51     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
    52 !
       
    53 
       
    54 label
       
    55     ^self tallyLabel, ' in ',
       
    56         self methodLabel, ' ',
       
    57             self packageLabel
       
    58 
       
    59     "Created: / 01-12-2007 / 20:46:01 / janfrog"
       
    60 !
       
    61 
       
    62 method
       
    63     ^ method
       
    64 
       
    65     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
    66 !
       
    67 
       
    68 method:aCompiledMethod
       
    69     method := aCompiledMethod.
       
    70 
       
    71     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
    72 !
       
    73 
       
    74 methodClass
       
    75 
       
    76     | mthd |
       
    77     mthd := self method.
       
    78     ^mthd
       
    79         ifNotNil:[method mclass]
       
    80         ifNil:[UndefinedObject]
       
    81 
       
    82     "Created: / 01-12-2007 / 20:49:57 / janfrog"
       
    83     "Modified: / 28-08-2010 / 21:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    84 !
       
    85 
       
    86 methodLabel
       
    87 
       
    88     ^(self isBlock ifTrue:['[] in '] ifFalse:['']), 
       
    89         self selector , 
       
    90             (' [' , self methodClass nameWithoutPrefix , ']') asText allBold
       
    91 
       
    92     "Created: / 01-12-2007 / 20:56:29 / janfrog"
       
    93     "Modified: / 01-12-2007 / 23:58:35 / janfrog"
       
    94 !
       
    95 
       
    96 packageLabel
       
    97 
       
    98     ^('[' , self method package , ']') asText allItalic
       
    99 
       
   100     "Created: / 01-12-2007 / 20:58:18 / janfrog"
       
   101 !
       
   102 
       
   103 selector
       
   104 
       
   105     | mthd |
       
   106     mthd := self method.
       
   107     ^mthd 
       
   108         ifNotNil:[method selector]
       
   109         ifNil:['<no method>']
       
   110 
       
   111     "Created: / 01-12-2007 / 20:49:13 / janfrog"
       
   112     "Modified: / 28-08-2010 / 21:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   113 !
       
   114 
       
   115 tally
       
   116     ^ tally ? 0
       
   117 
       
   118     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
   119     "Modified: / 01-12-2007 / 23:43:58 / janfrog"
       
   120 !
       
   121 
       
   122 tally:anInteger
       
   123     tally := anInteger.
       
   124 
       
   125     "Created: / 01-12-2007 / 20:38:11 / janfrog"
       
   126 !
       
   127 
       
   128 tallyAdd: anInteger
       
   129 
       
   130     tally := self tally + anInteger
       
   131 
       
   132     "Created: / 01-12-2007 / 22:53:55 / janfrog"
       
   133 !
       
   134 
       
   135 tallyLabel
       
   136 
       
   137     ^self tally printString , '% '
       
   138 
       
   139     "Created: / 01-12-2007 / 20:47:09 / janfrog"
       
   140 ! !
       
   141 
       
   142 !ProfilerInfoItem methodsFor:'accessing - private'!
       
   143 
       
   144 setChildren: collection
       
   145 
       
   146     children := collection.
       
   147     children do:[:e|e parent:e]
       
   148 
       
   149     "Created: / 01-12-2007 / 20:43:36 / janfrog"
       
   150 ! !
       
   151 
       
   152 !ProfilerInfoItem methodsFor:'comparing'!
       
   153 
       
   154 = anotherMethodInfo
       
   155 
       
   156     ^self class == anotherMethodInfo class
       
   157         and:[self method = anotherMethodInfo method
       
   158             and:[self isBlock = anotherMethodInfo isBlock]]
       
   159 
       
   160     "Created: / 01-12-2007 / 21:20:33 / janfrog"
       
   161 !
       
   162 
       
   163 hash
       
   164 
       
   165     ^self method hash bitXor: [self isBlock hash]
       
   166 
       
   167     "Created: / 01-12-2007 / 21:17:01 / janfrog"
       
   168 ! !
       
   169 
       
   170 !ProfilerInfoItem class methodsFor:'documentation'!
       
   171 
       
   172 version_CVS
       
   173     ^ '$Header: /cvs/stx/stx/libtool/Tools__ProfilerInfoItem.st,v 1.1 2011-07-01 13:27:56 cg Exp $'
       
   174 !
       
   175 
       
   176 version_SVN
       
   177     ^ '§Id: Tools__ProfilerInfoItem.st 7486 2009-10-26 22:06:24Z vranyj1 §'
       
   178 ! !