1 IN: tools.profiler.tests
2 USING: accessors tools.profiler tools.test kernel memory math
3 threads alien tools.profiler.private sequences compiler.units
8 10 [ { } length drop ] times
12 [ ] [ [ 10 [ gc ] times ] profile ] unit-test
14 [ ] [ [ 1000000 sleep ] profile ] unit-test
16 [ ] [ profile. ] unit-test
18 [ ] [ vocabs-profile. ] unit-test
20 [ ] [ "kernel.private" vocab-profile. ] unit-test
22 [ ] [ \ + usage-profile. ] unit-test
24 : callback-test ( -- callback ) "void" { } "cdecl" [ ] alien-callback ;
26 : indirect-test ( callback -- ) "void" { } "cdecl" alien-indirect ;
31 [ ] [ callback-test indirect-test ] unit-test
35 [ 1 ] [ \ foobar counter>> ] unit-test
37 : fooblah { } [ ] each ;
39 : foobaz fooblah fooblah ;
43 [ 1 ] [ \ foobaz counter>> ] unit-test
45 [ 2 ] [ \ fooblah counter>> ] unit-test
47 : recompile-while-profiling-test ( -- ) ;
51 333 [ recompile-while-profiling-test ] times
52 { recompile-while-profiling-test } compile
53 333 [ recompile-while-profiling-test ] times
57 [ 666 ] [ \ recompile-while-profiling-test counter>> ] unit-test
59 [ ] [ [ [ ] compile-call ] profile ] unit-test
61 [ [ gensym execute ] profile ] [ T{ undefined } = ] must-fail-with