Profiler's usage-profile word is now more useful: it uses compiled-usage instead of usage

db4
Slava Pestov 2008-12-18 02:19:33 -06:00
parent 7cee0cdc2a
commit 6e52dedd59
1 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,7 @@
USING: accessors words sequences math prettyprint kernel arrays io USING: accessors words sequences math prettyprint kernel arrays io
io.styles namespaces assocs kernel.private strings combinators io.styles namespaces assocs kernel.private strings combinators
sorting math.parser vocabs definitions tools.profiler.private sorting math.parser vocabs definitions tools.profiler.private
continuations generic ; continuations generic compiler.units sets ;
IN: tools.profiler IN: tools.profiler
: profile ( quot -- ) : profile ( quot -- )
@ -19,7 +19,7 @@ TUPLE: usage-profile word ;
C: <usage-profile> usage-profile C: <usage-profile> usage-profile
M: word (profile.) M: word (profile.)
dup unparse swap <usage-profile> write-object ; [ name>> "( no name )" or ] [ <usage-profile> ] bi write-object ;
TUPLE: vocab-profile vocab ; TUPLE: vocab-profile vocab ;
@ -29,8 +29,8 @@ M: string (profile.)
dup <vocab-profile> write-object ; dup <vocab-profile> write-object ;
M: method-body (profile.) M: method-body (profile.)
dup synopsis swap "method-generic" word-prop [ synopsis ] [ "method-generic" word-prop <usage-profile> ] bi
<usage-profile> write-object ; write-object ;
: counter. ( obj n -- ) : counter. ( obj n -- )
[ [
@ -58,7 +58,10 @@ M: method-body (profile.)
"Call counts for words which call " write "Call counts for words which call " write
dup pprint dup pprint
":" print ":" print
smart-usage [ word? ] filter counters counters. ; [ smart-usage [ word? ] filter ]
[ compiled-generic-usage keys ]
[ compiled-usage keys ]
tri 3append prune counters counters. ;
: vocabs-profile. ( -- ) : vocabs-profile. ( -- )
"Call counts for all vocabularies:" print "Call counts for all vocabularies:" print