]> gitweb.factorcode.org Git - factor.git/blob - extra/wordtimer/wordtimer-docs.factor
pcre2: fix un-named capture groups
[factor.git] / extra / wordtimer / wordtimer-docs.factor
1 USING: help.syntax help.markup kernel prettyprint sequences
2 quotations words strings ;
3 IN: wordtimer
4
5 HELP: reset-word-timer
6 { $description "resets the global wordtimes datastructure. Must be called before calling any word-timer annotated code"
7 } ;
8
9 HELP: add-timer
10 { $values { "word" word } }
11 { $description "annotates the word with timing code which stores timing information globally. You can then view the info with print-word-timings"
12 } ;
13
14 HELP: add-timers
15 { $values { "vocab" string } }
16 { $description "annotates all the words in the vocab with timer code. After profiling you can remove the annotations with reset-vocab"
17 } ;
18
19
20 HELP: reset-vocab
21 { $values { "vocab" string } }
22 { $description "removes the annotations from all the words in the vocab"
23 } ;
24
25 HELP: print-word-timings
26 { $description "Displays the timing information for each word-timer annotated word. Columns are: total time taken in microseconds, number of invocations, wordname"
27 } ;
28
29 HELP: correct-for-timing-overhead
30 { $description "attempts to correct the timings to take into account the overhead of the timing function. This is pretty error-prone but can be handy when you're timing words that only take a handful of milliseconds but are called a lot" } ;
31
32 HELP: profile-vocab
33 { $values { "vocab" string }
34           { "quot" "a quotation to run" } }
35 { $description "Annotates the words in the vocab with timing code then runs the quotation. Finally resets the words and prints the timings information."
36 } ;
37
38 HELP: wordtimer-call
39 { $values { "quot" quotation } }
40 { $description "Resets the wordtimer hash and runs the quotation. After the quotation has run it prints out the timed words"
41 } ;
42
43
44 ARTICLE: "wordtimer" "Word Timer"
45 "The " { $vocab-link "wordtimer" } " vocabulary measures accumulated execution time for words. If you just want to profile the accumulated time taken by all words in a vocab you can use " { $link profile-vocab } ". If you need more fine grained control then do the following: First annotate individual words with the " { $link add-timer } " word or whole vocabularies with " { $link add-timers } ". Then use " { $link wordtimer-call } " to invoke a quotation and print out the timings." ;
46
47 ABOUT: "wordtimer"