Tools__ProfilerInfoItem.st
author Claus Gittinger <cg@exept.de>
Fri, 01 Jul 2011 15:27:56 +0200
changeset 9993 3dec934db707
child 10059 6fe87cce6a78
permissions -rw-r--r--
initial checkin

"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

HierarchicalItem subclass:#ProfilerInfoItem
	instanceVariableNames:'method isBlock tally'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Browsers-New-Profiler'
!

!ProfilerInfoItem class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!ProfilerInfoItem methodsFor:'accessing'!

isBlock
    ^ isBlock ? false

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
    "Modified: / 01-12-2007 / 23:54:48 / janfrog"
!

isBlock:aBoolean
    isBlock := aBoolean.

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
!

label
    ^self tallyLabel, ' in ',
        self methodLabel, ' ',
            self packageLabel

    "Created: / 01-12-2007 / 20:46:01 / janfrog"
!

method
    ^ method

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
!

method:aCompiledMethod
    method := aCompiledMethod.

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
!

methodClass

    | mthd |
    mthd := self method.
    ^mthd
        ifNotNil:[method mclass]
        ifNil:[UndefinedObject]

    "Created: / 01-12-2007 / 20:49:57 / janfrog"
    "Modified: / 28-08-2010 / 21:02:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

methodLabel

    ^(self isBlock ifTrue:['[] in '] ifFalse:['']), 
        self selector , 
            (' [' , self methodClass nameWithoutPrefix , ']') asText allBold

    "Created: / 01-12-2007 / 20:56:29 / janfrog"
    "Modified: / 01-12-2007 / 23:58:35 / janfrog"
!

packageLabel

    ^('[' , self method package , ']') asText allItalic

    "Created: / 01-12-2007 / 20:58:18 / janfrog"
!

selector

    | mthd |
    mthd := self method.
    ^mthd 
        ifNotNil:[method selector]
        ifNil:['<no method>']

    "Created: / 01-12-2007 / 20:49:13 / janfrog"
    "Modified: / 28-08-2010 / 21:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

tally
    ^ tally ? 0

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
    "Modified: / 01-12-2007 / 23:43:58 / janfrog"
!

tally:anInteger
    tally := anInteger.

    "Created: / 01-12-2007 / 20:38:11 / janfrog"
!

tallyAdd: anInteger

    tally := self tally + anInteger

    "Created: / 01-12-2007 / 22:53:55 / janfrog"
!

tallyLabel

    ^self tally printString , '% '

    "Created: / 01-12-2007 / 20:47:09 / janfrog"
! !

!ProfilerInfoItem methodsFor:'accessing - private'!

setChildren: collection

    children := collection.
    children do:[:e|e parent:e]

    "Created: / 01-12-2007 / 20:43:36 / janfrog"
! !

!ProfilerInfoItem methodsFor:'comparing'!

= anotherMethodInfo

    ^self class == anotherMethodInfo class
        and:[self method = anotherMethodInfo method
            and:[self isBlock = anotherMethodInfo isBlock]]

    "Created: / 01-12-2007 / 21:20:33 / janfrog"
!

hash

    ^self method hash bitXor: [self isBlock hash]

    "Created: / 01-12-2007 / 21:17:01 / janfrog"
! !

!ProfilerInfoItem class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__ProfilerInfoItem.st,v 1.1 2011-07-01 13:27:56 cg Exp $'
!

version_SVN
    ^ '§Id: Tools__ProfilerInfoItem.st 7486 2009-10-26 22:06:24Z vranyj1 §'
! !