Unbreakify the new profiler, add a couple of unit tests to demonstrate displaying output.
parent
a09a278981
commit
7378ba7717
|
@ -1,6 +1,6 @@
|
||||||
USING: byte-arrays calendar kernel math memory namespaces
|
USING: byte-arrays calendar kernel math memory namespaces
|
||||||
random threads tools.profiler.sampling
|
random threads tools.profiler.sampling
|
||||||
tools.profiler.sampling.private tools.test ;
|
tools.profiler.sampling.private tools.test sequences ;
|
||||||
IN: tools.profiler.sampling.tests
|
IN: tools.profiler.sampling.tests
|
||||||
|
|
||||||
! Make sure the profiler doesn't blow up the VM
|
! Make sure the profiler doesn't blow up the VM
|
||||||
|
@ -11,6 +11,10 @@ TUPLE: boom ;
|
||||||
{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times compact-gc ] profile ] times ] unit-test
|
{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times compact-gc ] profile ] times ] unit-test
|
||||||
{ } [ 2 [ [ 1 seconds sleep ] profile ] times ] unit-test
|
{ } [ 2 [ [ 1 seconds sleep ] profile ] times ] unit-test
|
||||||
|
|
||||||
|
|
||||||
|
[ ] [ [ 10 iota [ sq ] map ] profile flat profile. ] unit-test
|
||||||
|
[ ] [ [ 10 iota [ sq ] map ] profile top-down profile. ] unit-test
|
||||||
|
|
||||||
(clear-samples)
|
(clear-samples)
|
||||||
f raw-profile-data set-global
|
f raw-profile-data set-global
|
||||||
gc
|
gc
|
||||||
|
|
|
@ -24,9 +24,8 @@ CONSTANT: ignore-words
|
||||||
|
|
||||||
: profile ( quot -- )
|
: profile ( quot -- )
|
||||||
samples-per-second get-global profiling
|
samples-per-second get-global profiling
|
||||||
[ 0 profiling ] [
|
[ 0 profiling (get-samples) raw-profile-data set-global ]
|
||||||
(get-samples) raw-profile-data set-global
|
[ ] cleanup ; inline
|
||||||
] cleanup ; inline
|
|
||||||
|
|
||||||
: total-sample-count ( sample -- count ) 0 swap nth ;
|
: total-sample-count ( sample -- count ) 0 swap nth ;
|
||||||
: gc-sample-count ( sample -- count ) 1 swap nth ;
|
: gc-sample-count ( sample -- count ) 1 swap nth ;
|
||||||
|
|
Loading…
Reference in New Issue