tools.profiler.sampling: make rate a global var

db4
Joe Groff 2011-11-01 20:24:17 -07:00
parent 4330a645f4
commit 1745e22211
1 changed files with 3 additions and 5 deletions

View File

@ -11,7 +11,7 @@ IN: tools.profiler.sampling
SYMBOL: raw-profile-data
SYMBOL: samples-per-second
CONSTANT: default-samples-per-second 1000
samples-per-second [ 1,000 ] initialize
CONSTANT: ignore-words
{ signal-handler leaf-signal-handler profiling minor-gc }
@ -21,13 +21,11 @@ CONSTANT: ignore-words
: get-raw-profile-data ( -- data )
raw-profile-data get-global [ "No profile data" throw ] unless* ;
: profile* ( rate quot -- )
[ [ samples-per-second set-global ] [ profiling ] bi ] dip
: profile ( quot -- )
samples-per-second get-global profiling
[ 0 profiling ] [ ] cleanup
(get-samples) raw-profile-data set-global ; inline
: profile ( quot -- ) default-samples-per-second swap profile* ; inline
: total-sample-count ( sample -- count ) first ;
: gc-sample-count ( sample -- count ) second ;
: foreign-sample-count ( sample -- count ) third ;