 USING: accessors words sequences math prettyprint kernel arrays io
 io.styles namespaces assocs kernel.private strings combinators
 sorting math.parser vocabs definitions tools.profiler.private
-continuations generic ;
+continuations generic compiler.units sets ;
 IN: tools.profiler
 
 : profile ( quot -- )

C: <usage-profile> usage-profile

M: word (profile.)
    dup unparse swap <usage-profile> write-object ;

TUPLE: vocab-profile vocab ;


    "Call counts for words which call " write
    dup pprint
    ":" print
    [ smart-usage [ word? ] filter ]
    [ compiled-generic-usage keys ]
    [ compiled-usage keys ]
    tri 3append prune counters counters. ;

: vocabs-profile. ( -- )
    "Call counts for all vocabularies:" print
