fix teh docs

db4
Doug Coleman 2008-08-30 13:31:13 -05:00
parent e5bec5bbb8
commit dadd614fcb
2 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,5 @@
USING: help.syntax help.markup kernel prettyprint sequences ; USING: help.syntax help.markup kernel prettyprint sequences
quotations words strings ;
IN: wordtimer IN: wordtimer
HELP: reset-word-timer HELP: reset-word-timer
@ -6,18 +7,18 @@ HELP: reset-word-timer
} ; } ;
HELP: add-timer HELP: add-timer
{ $values { "word" "a word" } } { $values { "word" word } }
{ $description "annotates the word with timing code which stores timing information globally. You can then view the info with print-word-timings" { $description "annotates the word with timing code which stores timing information globally. You can then view the info with print-word-timings"
} ; } ;
HELP: add-timers HELP: add-timers
{ $values { "vocab" "a string" } } { $values { "vocab" string } }
{ $description "annotates all the words in the vocab with timer code. After profiling you can remove the annotations with reset-vocab" { $description "annotates all the words in the vocab with timer code. After profiling you can remove the annotations with reset-vocab"
} ; } ;
HELP: reset-vocab HELP: reset-vocab
{ $values { "vocab" "a string" } } { $values { "vocab" string } }
{ $description "removes the annotations from all the words in the vocab" { $description "removes the annotations from all the words in the vocab"
} ; } ;
@ -29,13 +30,13 @@ HELP: correct-for-timing-overhead
{ $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" } ; { $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" } ;
HELP: profile-vocab HELP: profile-vocab
{ $values { "vocabspec" "string name of a vocab" } { $values { "vocab" string }
{ "quot" "a quotation to run" } } { "quot" "a quotation to run" } }
{ $description "Annotates the words in the vocab with timing code then runs the quotation. Finally resets the words and prints the timings information." { $description "Annotates the words in the vocab with timing code then runs the quotation. Finally resets the words and prints the timings information."
} ; } ;
HELP: wordtimer-call HELP: wordtimer-call
{ $values { "quot" "a quotation to run" } } { $values { "quot" quotation } }
{ $description "Resets the wordtimer hash and runs the quotation. After the quotation has run it prints out the timed words" { $description "Resets the wordtimer hash and runs the quotation. After the quotation has run it prints out the timed words"
} ; } ;

View File

@ -40,10 +40,10 @@ SYMBOL: *calling*
: add-timer ( word -- ) : add-timer ( word -- )
dup [ (add-timer) ] annotate ; dup [ (add-timer) ] annotate ;
: add-timers ( vocabspec -- ) : add-timers ( vocab -- )
words [ add-timer ] each ; words [ add-timer ] each ;
: reset-vocab ( vocabspec -- ) : reset-vocab ( vocab -- )
words [ reset ] each ; words [ reset ] each ;
: dummy-word ( -- ) ; : dummy-word ( -- ) ;
@ -74,7 +74,7 @@ SYMBOL: *calling*
"total time:" write r> pprint nl "total time:" write r> pprint nl
print-word-timings nl ; print-word-timings nl ;
: profile-vocab ( vocabspec quot -- ) : profile-vocab ( vocab quot -- )
"annotating vocab..." print flush "annotating vocab..." print flush
over [ reset-vocab ] [ add-timers ] bi over [ reset-vocab ] [ add-timers ] bi
reset-word-timer reset-word-timer