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