1 IN: tools.profiler.tests
2 USING: accessors tools.profiler tools.test kernel memory math
3 threads alien tools.profiler.private sequences compiler.units ;
7 10 [ { } length drop ] times
11 [ ] [ [ 10 [ gc ] times ] profile ] unit-test
13 [ ] [ [ 1000 sleep ] profile ] unit-test
15 [ ] [ profile. ] unit-test
17 [ ] [ vocabs-profile. ] unit-test
19 [ ] [ "kernel.private" vocab-profile. ] unit-test
21 [ ] [ \ + usage-profile. ] unit-test
23 : callback-test ( -- callback ) "void" { } "cdecl" [ ] alien-callback ;
25 : indirect-test ( callback -- ) "void" { } "cdecl" alien-indirect ;
30 [ ] [ callback-test indirect-test ] unit-test
34 [ 1 ] [ \ foobar counter>> ] unit-test
36 : fooblah { } [ ] each ;
38 : foobaz fooblah fooblah ;
42 [ 1 ] [ \ foobaz counter>> ] unit-test
44 [ 2 ] [ \ fooblah counter>> ] unit-test
46 : recompile-while-profiling-test ( -- ) ;
50 333 [ recompile-while-profiling-test ] times
51 { recompile-while-profiling-test } compile
52 333 [ recompile-while-profiling-test ] times
56 [ 666 ] [ \ recompile-while-profiling-test counter>> ] unit-test