InstrumentedMethod.st
author Claus Gittinger <cg@exept.de>
Tue, 27 Apr 2010 14:53:46 +0200
changeset 2358 c0142b56dc94
parent 2355 f84f052fd33f
child 2367 0ac586956983
permissions -rw-r--r--
added: #blockInvocationInfo #hasBeenCalled #haveAllBlocksBeenExecuted #methodInvocationInfo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2355
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2010 by eXept Software AG
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libcomp' }"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Method variableSubclass:#InstrumentedMethod
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Compiler-Instrumentation'
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!InstrumentedMethod class methodsFor:'documentation'!
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 2010 by eXept Software AG
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    Instances of me are created by the instrumenting compiler.
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    [author:]
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        Claus Gittinger
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
! !
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
2358
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    46
!InstrumentedMethod methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    47
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    48
blockInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    49
    |info|
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    50
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    51
    info := OrderedCollection new.
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    52
    self literalsDo:[:lit | 
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    53
        (lit isKindOf:InstrumentingCompiler::BlockExecutionInfo) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    54
            info add:lit
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    55
        ]
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    56
    ].
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    57
    ^ info
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    58
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    59
    "Created: / 27-04-2010 / 13:47:21 / cg"
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    60
    "Modified: / 27-04-2010 / 14:52:30 / cg"
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    61
!
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    62
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    63
methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    64
    ^ self literalsDetect:[:lit | lit isKindOf:InstrumentingCompiler::MethodInvocationInfo] ifNone:nil
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    65
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    66
    "Created: / 27-04-2010 / 13:34:01 / cg"
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    67
! !
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    68
2355
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
!InstrumentedMethod methodsFor:'queries'!
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
2358
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    71
hasBeenCalled
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    72
    |info|
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    73
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    74
    ^ (info := self methodInvocationInfo) notNil
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    75
    and:[ info hasBeenCalled ]
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    76
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    77
    "Created: / 27-04-2010 / 13:03:33 / cg"
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    78
!
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    79
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    80
haveAllBlocksBeenExecuted
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    81
    ^ self blockInvocationInfo conform:[:eachBlockInfo | eachBlockInfo callCount > 0]
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    82
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    83
    "Modified: / 27-04-2010 / 13:44:46 / cg"
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    84
!
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    85
2355
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
isInstrumented
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    ^ true
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    "Created: / 27-04-2010 / 12:25:39 / cg"
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
! !
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
!InstrumentedMethod class methodsFor:'documentation'!
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
version_CVS
2358
Claus Gittinger <cg@exept.de>
parents: 2355
diff changeset
    95
    ^ '$Header: /cvs/stx/stx/libcomp/InstrumentedMethod.st,v 1.2 2010-04-27 12:53:46 cg Exp $'
2355
f84f052fd33f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
! !