2010-03-15 21:00:15 -04:00
|
|
|
! Copyright (C) 2003, 2010 Slava Pestov.
|
2007-09-20 18:09:08 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2010-03-15 21:00:15 -04:00
|
|
|
USING: system kernel math namespaces io prettyprint tools.memory
|
2009-11-05 02:07:59 -05:00
|
|
|
tools.dispatch ;
|
2007-09-20 18:09:08 -04:00
|
|
|
IN: tools.time
|
|
|
|
|
2008-05-09 10:05:52 -04:00
|
|
|
: benchmark ( quot -- runtime )
|
2009-11-18 16:58:48 -05:00
|
|
|
nano-count [ call nano-count ] dip - ; inline
|
2008-05-07 18:42:41 -04:00
|
|
|
|
2009-04-28 23:45:19 -04:00
|
|
|
: time. ( time -- )
|
2009-11-18 16:58:48 -05:00
|
|
|
"Running time: " write 1000000000 /f pprint " seconds" print ;
|
2009-04-28 23:45:19 -04:00
|
|
|
|
2009-11-05 02:07:59 -05:00
|
|
|
: time-banner. ( -- )
|
|
|
|
"Additional information was collected." print
|
|
|
|
"dispatch-stats. - Print method dispatch statistics" print
|
|
|
|
"gc-events. - Print all garbage collection events" print
|
|
|
|
"gc-stats. - Print breakdown of different garbage collection events" print
|
2012-08-10 18:23:10 -04:00
|
|
|
"gc-summary. - Print aggregate garbage collection statistics" print flush ;
|
2009-04-28 23:45:19 -04:00
|
|
|
|
2007-09-20 18:09:08 -04:00
|
|
|
: time ( quot -- )
|
2010-03-15 21:00:15 -04:00
|
|
|
[
|
|
|
|
[ benchmark ] collect-dispatch-stats last-dispatch-stats set
|
|
|
|
] collect-gc-events gc-events set
|
2009-11-05 02:07:59 -05:00
|
|
|
time. nl time-banner. ; inline
|