1 USING: assocs byte-arrays calendar kernel kernel.private math
2 memory namespaces parser random sequences threads
3 tools.profiler.sampling tools.profiler.sampling.private
5 IN: tools.profiler.sampling.tests
7 ! collect-tops: top is the last element in the array
9 { { 1 2 3 4 5 6 { 3 4 5 } } } 1 2 collect-tops
13 ! Make sure the profiler doesn't blow up the VM
15 { } [ 10 [ [ ] profile ] times ] unit-test
16 [ 10 [ [ boom new throw ] profile ] times ] [ boom? ] must-fail-with
18 { t t t t t t t t t t } [
21 100 [ 1000 random (byte-array) >boolean t assert= ] times gc
22 ] profile raw-profile-data get-global >boolean
26 { t t t t t t t t t t } [
29 100 [ 1000 random (byte-array) >boolean t assert= ] times compact-gc
30 ] profile raw-profile-data get-global >boolean
36 [ 1 seconds sleep ] profile
37 raw-profile-data get-global >boolean
42 [ 1,000,000 <iota> [ sq sq sq ] map >boolean t assert= ] profile
43 raw-profile-data get-global >boolean
46 f raw-profile-data set-global
50 ! Seed the samples data
51 [ "resource:basis/tools/memory/memory.factor" run-file ] profile
52 get-samples length 0 >
53 OBJ-SAMPLE-CALLSTACKS special-object first 0 >
57 ! On x86.64, [ ] profile doesn't generate any samples at all
58 ! because it runs so quickly. On x86.32, one spurious sample is
59 ! sometimes generated for some unknown reason.
60 gc [ ] profile get-samples length 1 <=