 : foreign-thread-time ( -- n )
     get-raw-profile-data (foreign-thread-time) ;
 
-: collect-contexts ( samples -- by-top )
-    [ sample-context ] collect-by ;
+: collect-threads ( samples -- by-top )
+    [ sample-thread ] collect-by ;
 
-: time-per-context ( -- n )
-    get-raw-profile-data collect-contexts [ (total-time) ] assoc-map ;
+: time-per-thread ( -- n )
+    get-raw-profile-data collect-threads [ (total-time) ] assoc-map ;
 
 : unclip-callstack ( sample -- sample' callstack-top )
     clone 5 over [ unclip swap ] change-nth ;

combinators.short-circuit continuations fry io kernel
kernel.private locals math math.statistics math.vectors memory
namespaces prettyprint sequences sorting
tools.profiler.sampling.private ;
FROM: sequences => change-nth ;
IN: tools.profiler.sampling

SYMBOL: raw-profile-data

    } cleave ;

:: (profile-node.) ( word node depth -- )
    depth depth. node times. ": " write word pprint-short nl
    node children>> depth 1 + (profile.) ;

: (profile.) ( nodes depth -- )
