factor/basis/tools/time/time-docs.factor

38 lines
1.6 KiB
Factor
Raw Normal View History

2009-11-05 02:07:59 -05:00
USING: help.markup help.syntax memory system tools.dispatch
tools.memory quotations vm ;
2007-09-20 18:09:08 -04:00
IN: tools.time
2009-11-05 02:07:59 -05:00
ARTICLE: "timing" "Timing code and collecting statistics"
2007-09-20 18:09:08 -04:00
"You can time the execution of a quotation in the listener:"
{ $subsections time }
2009-11-05 02:07:59 -05:00
"This word also collects statistics about method dispatch and garbage collection:"
{ $subsections dispatch-stats. gc-events. gc-stats. gc-summary. }
2007-09-20 18:09:08 -04:00
"A lower-level word puts timings on the stack, intead of printing:"
{ $subsections benchmark }
2009-11-21 18:46:27 -05:00
"You can also read the system clock directly; see " { $link "system" } "."
2009-10-27 04:37:05 -04:00
{ $see-also "profiling" "calendar" } ;
2007-09-20 18:09:08 -04:00
ABOUT: "timing"
HELP: benchmark
2009-11-05 02:07:59 -05:00
{ $values { "quot" quotation }
{ "runtime" "the runtime in microseconds" } }
2008-05-10 16:23:49 -04:00
{ $description "Runs a quotation, measuring the total wall clock time." }
2007-09-20 18:09:08 -04:00
{ $notes "A nicer word for interactive use is " { $link time } "." } ;
HELP: time
2009-11-05 02:07:59 -05:00
{ $values { "quot" quotation } }
{ $description "Runs a quotation, gathering statistics about method dispatch and garbage collection, and then prints the total run time." } ;
2007-09-20 18:09:08 -04:00
{ benchmark system-micros time } related-words
2009-11-05 02:07:59 -05:00
HELP: collect-gc-events
{ $values { "quot" quotation } }
{ $description "Calls the quotation, storing an array of " { $link gc-event } " instances in the " { $link gc-events } " variable." }
{ $notes "The " { $link time } " combinator automatically calls this combinator." } ;
HELP: collect-dispatch-stats
{ $values { "quot" quotation } }
{ $description "Calls the quotation, collecting method dispatch statistics and storing them in the " { $link last-dispatch-stats } " variable. " }
{ $notes "The " { $link time } " combinator automatically calls this combinator." } ;