factor/basis/tools/time/time.factor

23 lines
831 B
Factor
Raw Normal View History

2009-10-27 04:37:05 -04:00
! Copyright (C) 2003, 2009 Slava Pestov.
2007-09-20 18:09:08 -04:00
! See http://factorcode.org/license.txt for BSD license.
2009-11-05 02:07:59 -05:00
USING: system kernel math io prettyprint tools.memory
tools.dispatch ;
2007-09-20 18:09:08 -04:00
IN: tools.time
: benchmark ( quot -- runtime )
2008-12-03 09:46:16 -05:00
micros [ call micros ] dip - ; inline
2008-05-07 18:42:41 -04:00
: time. ( time -- )
2009-11-05 02:07:59 -05:00
"Running time: " write 1000000 /f pprint " seconds" print ;
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
"gc-summary. - Print aggregate garbage collection statistics" print ;
2007-09-20 18:09:08 -04:00
: time ( quot -- )
2009-11-05 02:07:59 -05:00
[ [ benchmark ] collect-dispatch-stats ] collect-gc-events
time. nl time-banner. ; inline