USING: byte-arrays calendar kernel math memory namespaces
random threads tools.profiler.sampling
-tools.profiler.sampling.private tools.test ;
+tools.profiler.sampling.private tools.test sequences ;
IN: tools.profiler.sampling.tests
! Make sure the profiler doesn't blow up the VM
{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times compact-gc ] 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)
f raw-profile-data set-global
gc
: profile ( quot -- )
samples-per-second get-global profiling
- [ 0 profiling ] [
- (get-samples) raw-profile-data set-global
- ] cleanup ; inline
+ [ 0 profiling (get-samples) raw-profile-data set-global ]
+ [ ] cleanup ; inline
: total-sample-count ( sample -- count ) 0 swap nth ;
: gc-sample-count ( sample -- count ) 1 swap nth ;