fix teh docs
parent
e5bec5bbb8
commit
dadd614fcb
|
@ -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
|
||||
|
||||
HELP: reset-word-timer
|
||||
|
@ -6,18 +7,18 @@ HELP: reset-word-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"
|
||||
} ;
|
||||
|
||||
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"
|
||||
} ;
|
||||
|
||||
|
||||
HELP: reset-vocab
|
||||
{ $values { "vocab" "a string" } }
|
||||
{ $values { "vocab" string } }
|
||||
{ $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" } ;
|
||||
|
||||
HELP: profile-vocab
|
||||
{ $values { "vocabspec" "string name of a vocab" }
|
||||
{ $values { "vocab" string }
|
||||
{ "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."
|
||||
} ;
|
||||
|
||||
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"
|
||||
} ;
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ SYMBOL: *calling*
|
|||
: add-timer ( word -- )
|
||||
dup [ (add-timer) ] annotate ;
|
||||
|
||||
: add-timers ( vocabspec -- )
|
||||
: add-timers ( vocab -- )
|
||||
words [ add-timer ] each ;
|
||||
|
||||
: reset-vocab ( vocabspec -- )
|
||||
: reset-vocab ( vocab -- )
|
||||
words [ reset ] each ;
|
||||
|
||||
: dummy-word ( -- ) ;
|
||||
|
@ -74,7 +74,7 @@ SYMBOL: *calling*
|
|||
"total time:" write r> pprint nl
|
||||
print-word-timings nl ;
|
||||
|
||||
: profile-vocab ( vocabspec quot -- )
|
||||
: profile-vocab ( vocab quot -- )
|
||||
"annotating vocab..." print flush
|
||||
over [ reset-vocab ] [ add-timers ] bi
|
||||
reset-word-timer
|
||||
|
|
Loading…
Reference in New Issue