tools.profiler.sampling: assert that profile-data is created.

master
John Benediktsson 2020-08-13 14:50:52 -07:00
parent 5eaaaf06d6
commit 995d717277
1 changed files with 31 additions and 8 deletions

View File

@ -1,6 +1,7 @@
USING: assocs byte-arrays calendar kernel kernel.private math memory
namespaces parser random sequences threads tools.profiler.sampling
tools.profiler.sampling.private tools.test ;
USING: assocs byte-arrays calendar kernel kernel.private math
memory namespaces parser random sequences threads
tools.profiler.sampling tools.profiler.sampling.private
tools.test ;
IN: tools.profiler.sampling.tests
! collect-tops: top is the last element in the array
@ -13,12 +14,34 @@ IN: tools.profiler.sampling.tests
TUPLE: boom ;
{ } [ 10 [ [ ] profile ] times ] unit-test
[ 10 [ [ boom new throw ] profile ] times ] [ boom? ] must-fail-with
{ } [ 10 [ [ 100 [ 1000 random (byte-array) drop ] times 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
{ } [ [ 1,000,000 <iota> [ sq sq sq ] map drop ] profile flat profile. ] unit-test
{ } [ [ 1,000,000 <iota> [ sq sq sq ] map drop ] profile top-down profile. ] unit-test
{ t t t t t t t t t t } [
10 [
[
100 [ 1000 random (byte-array) >boolean t assert= ] times gc
] profile raw-profile-data get-global >boolean
] times
] unit-test
{ t t t t t t t t t t } [
10 [
[
100 [ 1000 random (byte-array) >boolean t assert= ] times compact-gc
] profile raw-profile-data get-global >boolean
] times
] unit-test
{ t t } [
2 [
[ 1 seconds sleep ] profile
raw-profile-data get-global >boolean
] times
] unit-test
{ t } [
[ 1,000,000 <iota> [ sq sq sq ] map >boolean t assert= ] profile
raw-profile-data get-global >boolean
] unit-test
f raw-profile-data set-global
gc