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

    zero-counts [ sample-counts-slice v+ ] reduce ;

TUPLE: profile-node
    total-time gc-time jit-time foreign-time foreign-thread-time children ;

: <profile-node> ( times children -- node )
    [ 5 firstn [ samples>time ] 5 napply ] dip profile-node boa ;

: <profile-root-node> ( samples collector-quot -- node )
    [ sum-counts ] swap bi <profile-node> ; inline

:: (collect-subtrees) ( samples child-quot -- children )
    samples [ sample-callstack leaf-callstack? not ] filter
    [ f ] [ child-quot call ] if-empty ; inline

: collect-tops ( samples -- node )
    [ unclip-callstack ] collect-pairs [
        [ sum-counts ]
        [ [ collect-tops ] (collect-subtrees) ] bi <profile-node>
    ] assoc-map ;

: redundant-root-node? ( assoc -- ? )


DEFER: (profile.)

:: times. ( node depth -- )
    node {
        [ depth>> number>string 3 CHAR: \s pad-head write " " write depth depth. ]
        [ total-time>> duration. ]
        [ " (GC:" write [ gc-time>> ] [ total-time>> ] bi percentage. ]
        [ ", JIT:" write [ jit-time>> ] [ total-time>> ] bi percentage. ]
