Tools__Profiler.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Jan 2020 21:02:47 +0100
changeset 19422 c6ca1c3e0fd7
parent 12026 8ab9fdf1d225
child 12401 4714b9640528
permissions -rw-r--r--
#REFACTORING by exept class: MultiViewToolApplication added: #askForFile:default:forSave:thenDo: changed: #askForFile:default:thenDo: #askForFile:thenDo: #menuSaveAllAs #menuSaveAs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10060
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     3
              All Rights Reserved
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10060
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     5
Permission is hereby granted, free of charge, to any person
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     6
obtaining a copy of this software and associated documentation
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     7
files (the 'Software'), to deal in the Software without
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     8
restriction, including without limitation the rights to use,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    10
copies of the Software, and to permit persons to whom the
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    11
Software is furnished to do so, subject to the following
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    12
conditions:
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    13
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    14
The above copyright notice and this permission notice shall be
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    15
included in all copies or substantial portions of the Software.
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    16
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
MessageTally subclass:#Profiler
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    31
	instanceVariableNames:'startTimestamp notes retVal'
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
	classVariableNames:''
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	category:'Interface-Browsers-New-Profiler'
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!Profiler class methodsFor:'documentation'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
copyright
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10060
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    41
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    42
              All Rights Reserved
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    43
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    44
Permission is hereby granted, free of charge, to any person
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    45
obtaining a copy of this software and associated documentation
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    46
files (the 'Software'), to deal in the Software without
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    47
restriction, including without limitation the rights to use,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    48
copy, modify, merge, publish, distribute, sublicense, and/or sell
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    49
copies of the Software, and to permit persons to whom the
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    50
Software is furnished to do so, subject to the following
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    51
conditions:
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
10060
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    53
The above copyright notice and this permission notice shall be
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    54
included in all copies or substantial portions of the Software.
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    55
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    56
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    57
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    58
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    59
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    60
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    61
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    62
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
cb3aa9c7ad8f copyright
Claus Gittinger <cg@exept.de>
parents: 9991
diff changeset
    63
OTHER DEALINGS IN THE SOFTWARE.
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
12026
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    67
documentation
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    68
"
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    69
    a visual profiler;
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    70
    provides the same interface as a MessageTally, but does not show the
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    71
    sample data on a stream, instead a browser is opened, allowing easy
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    72
    navigation through the sampled code.
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    73
"
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    74
!
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
    75
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    76
examples
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    77
"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    78
                                                                    [exBegin]
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    79
    | profiler |
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    81
    profiler := Tools::Profiler profileOn:[1 to: 1000 do:[:i|i factorial]] interval: 10.
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    Tools::NewSystemBrowser browseProfilerStatistics: profiler
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    83
                                                                    [exEnd]
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    85
                                                                    [exBegin]
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    86
    Tools::Profiler spyOn:[1 to: 1000 do:[:i|i factorial]] interval: 10.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    87
                                                                    [exEnd]
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    88
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
    89
"
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
!Profiler class methodsFor:'instance creation'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
readStatisticsFrom: stream
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ^BinaryInputManager readFrom: stream
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    "Created: / 24-11-2007 / 09:24:12 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   101
!Profiler class methodsFor:'messageTally compatible interface'!
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   102
12024
d9abe8cde031 added: #spyDetailedOn:
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   103
spyDetailedOn: aBlock
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   104
    "execute a Block; then open a visual profiler.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   105
     Return the value from aBlock"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   106
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   107
    ^ self spyOn:aBlock interval:(self detailedSamplingIntervalMS)
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   108
!
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   109
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   110
spyOn: aBlock
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   111
    "execute a Block; then open a visual profiler.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   112
     Return the value from aBlock"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   113
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   114
    ^ self spyOn:aBlock interval:(self normalSamplingIntervalMS)
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   115
!
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   116
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   117
spyOn: aBlock interval: interval
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   118
    "execute a Block; then open a visual profiler.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   119
     Return the value from aBlock"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   120
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   121
    | profiler |
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   122
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   123
    profiler := self new.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   124
    profiler profileOn:aBlock interval: interval.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   125
    Tools::NewSystemBrowser browseProfilerStatistics: profiler.
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   126
    ^ profiler retVal
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   127
! !
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   128
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
!Profiler class methodsFor:'profiling'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
profile: aBlock
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   132
    "run aBlock, return profile information"
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   134
    ^self profileOn: aBlock
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "Created: / 18-02-2008 / 20:24:08 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
profileAndOpenBrowser: aBlock
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   140
    "run aBlock, open a browser on the profile information; sample tick is 10ms"
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   142
    Tools::NewSystemBrowser browseProfilerStatistics: (self profile: aBlock)
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    "
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
        Tools::Profiler profileAndOpenBrowser:[ 10000 timesRepeat:[100 factorial] ] 
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    "
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    "Created: / 18-02-2008 / 20:24:56 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    "Modified: / 18-02-2008 / 22:16:29 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   152
profileDetailedOn: aBlock
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   153
    "run aBlock, return profile information; sample tick is 1ms"
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   155
    ^self profileOn: aBlock interval:(self detailedSamplingIntervalMS)
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "Created: / 24-11-2007 / 08:31:22 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    "Modified: / 25-12-2008 / 20:39:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   161
profileOn: aBlock
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   162
    "run aBlock, return profile information; sample tick is 10ms"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   163
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   164
    ^self profileOn: aBlock interval:(self normalSamplingIntervalMS)
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   166
    "Created: / 24-11-2007 / 08:31:22 / janfrog"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   167
    "Modified: / 25-12-2008 / 20:39:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   168
!
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   169
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   170
profileOn: aBlock interval: interval
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   171
    "run aBlock, return profile information; sample tick is interval (ms)"
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   172
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   173
    ^self new profileOn: aBlock interval: interval
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    "Created: / 24-11-2007 / 08:25:37 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
!Profiler methodsFor:'I/O'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
storeStatisticsOn: stream
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    ^BinaryOutputManager store: self on: stream
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "Created: / 24-11-2007 / 09:23:11 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
!Profiler methodsFor:'accessing'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
computationTime
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    ^ endTime - startTime
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    "Created: / 24-11-2007 / 08:41:33 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
notes
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    ^ notes
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    "Created: / 24-11-2007 / 09:24:50 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
notes:something
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    notes := something.
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    "Created: / 24-11-2007 / 09:24:50 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   207
retVal
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   208
    ^ retVal
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   209
!
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   210
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
startTimestamp
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    ^ startTimestamp
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    "Created: / 24-11-2007 / 09:01:12 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
!Profiler methodsFor:'profiling'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   219
profileOn: aBlock interval: interval
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    startTimestamp := Timestamp now.
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   221
    retVal := super spyOn: aBlock interval: interval.
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    self nTally isZero ifFalse:[self tree computePercentage: self nTally].
12023
db541e9a6fc1 changed the protocol slightly to make it compatible with
Claus Gittinger <cg@exept.de>
parents: 10060
diff changeset
   223
    ^ self
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    "Created: / 24-11-2007 / 08:21:28 / janfrog"
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
! !
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
!Profiler class methodsFor:'documentation'!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
12024
d9abe8cde031 added: #spyDetailedOn:
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   230
version
12026
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
   231
    ^ '$Header: /cvs/stx/stx/libtool/Tools__Profiler.st,v 1.5 2012-11-04 21:42:25 cg Exp $'
12024
d9abe8cde031 added: #spyDetailedOn:
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   232
!
d9abe8cde031 added: #spyDetailedOn:
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   233
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
version_CVS
12026
8ab9fdf1d225 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 12024
diff changeset
   235
    ^ '$Header: /cvs/stx/stx/libtool/Tools__Profiler.st,v 1.5 2012-11-04 21:42:25 cg Exp $'
9991
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
!
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
version_SVN
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    ^ '§Id: Tools__Profiler.st 7486 2009-10-26 22:06:24Z vranyj1 §'
5d0495aa2e5e initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
! !