factor/basis/tools/profiler/profiler-tests.factor

62 lines
1.3 KiB
Factor
Raw Normal View History

2008-03-01 17:00:45 -05:00
IN: tools.profiler.tests
2008-06-30 04:57:00 -04:00
USING: accessors tools.profiler tools.test kernel memory math
threads alien tools.profiler.private sequences compiler.units
words ;
2007-12-29 12:44:01 -05:00
[ t ] [
2008-06-30 04:57:00 -04:00
\ length counter>>
2007-12-29 12:44:01 -05:00
10 [ { } length drop ] times
2008-06-30 04:57:00 -04:00
\ length counter>> =
2007-12-29 12:44:01 -05:00
] unit-test
2007-09-20 18:09:08 -04:00
[ ] [ [ 10 [ gc ] times ] profile ] unit-test
2007-09-20 18:09:08 -04:00
[ ] [ [ 1000000 sleep ] profile ] unit-test
2007-09-20 18:09:08 -04:00
[ ] [ profile. ] unit-test
[ ] [ vocabs-profile. ] unit-test
[ ] [ "kernel.private" vocab-profile. ] unit-test
[ ] [ \ + usage-profile. ] unit-test
2008-06-08 17:47:20 -04:00
: callback-test ( -- callback ) "void" { } "cdecl" [ ] alien-callback ;
2007-09-20 18:09:08 -04:00
2008-06-08 17:47:20 -04:00
: indirect-test ( callback -- ) "void" { } "cdecl" alien-indirect ;
2007-09-20 18:09:08 -04:00
: foobar ;
[
[ ] [ callback-test indirect-test ] unit-test
foobar
] profile
2008-06-30 04:57:00 -04:00
[ 1 ] [ \ foobar counter>> ] unit-test
2007-12-29 12:44:01 -05:00
: fooblah { } [ ] each ;
: foobaz fooblah fooblah ;
[ foobaz ] profile
2008-06-30 04:57:00 -04:00
[ 1 ] [ \ foobaz counter>> ] unit-test
2007-12-29 12:44:01 -05:00
2008-06-30 04:57:00 -04:00
[ 2 ] [ \ fooblah counter>> ] unit-test
2008-07-05 23:19:16 -04:00
: recompile-while-profiling-test ( -- ) ;
[ ] [
[
333 [ recompile-while-profiling-test ] times
{ recompile-while-profiling-test } compile
333 [ recompile-while-profiling-test ] times
] profile
] unit-test
[ 666 ] [ \ recompile-while-profiling-test counter>> ] unit-test
[ ] [ [ [ ] compile-call ] profile ] unit-test
[ [ gensym execute ] profile ] [ T{ undefined } = ] must-fail-with