tools.profiler.sampling: mess with formatting more
parent
0c701fb68d
commit
8679fe82bb
|
@ -163,35 +163,41 @@ TUPLE: profile-node
|
||||||
get-raw-profile-data (cross-section) ;
|
get-raw-profile-data (cross-section) ;
|
||||||
|
|
||||||
: depth. ( depth -- )
|
: depth. ( depth -- )
|
||||||
[ "| " write ] times ;
|
[ " " write ] times ;
|
||||||
|
|
||||||
: by-total-time ( nodes -- nodes' )
|
: by-total-time ( nodes -- nodes' )
|
||||||
>alist [ second total-time>> ] inv-sort-with ;
|
>alist [ second total-time>> ] inv-sort-with ;
|
||||||
|
|
||||||
: duration. ( duration -- )
|
: duration. ( duration -- )
|
||||||
duration>milliseconds >float "%9.1fms" format-float write ;
|
duration>milliseconds >float "%9.1f" format-float write ;
|
||||||
|
|
||||||
: percentage. ( num denom -- )
|
: percentage. ( num denom -- )
|
||||||
[ duration>seconds ] bi@ [ 100 * ] dip /f "%6.2f%%" format-float write ;
|
[ duration>seconds ] bi@ [ 100 * ] dip /f "%6.2f" format-float write ;
|
||||||
|
|
||||||
DEFER: (profile.)
|
DEFER: (profile.)
|
||||||
|
|
||||||
:: times. ( node depth -- )
|
:: times. ( node -- )
|
||||||
node {
|
node {
|
||||||
[ depth>> number>string 3 CHAR: \s pad-head write " " write depth depth. ]
|
[ depth>> number>string 4 CHAR: \s pad-head write " " write ]
|
||||||
[ total-time>> duration. ]
|
[ total-time>> duration. " " write ]
|
||||||
[ " (GC:" write [ gc-time>> ] [ total-time>> ] bi percentage. ]
|
[ [ gc-time>> ] [ total-time>> ] bi percentage. " " write ]
|
||||||
[ ", JIT:" write [ jit-time>> ] [ total-time>> ] bi percentage. ]
|
[ [ jit-time>> ] [ total-time>> ] bi percentage. " " write ]
|
||||||
[ ", FFI:" write [ foreign-time>> ] [ total-time>> ] bi percentage. ]
|
[ [ foreign-time>> ] [ total-time>> ] bi percentage. " " write ]
|
||||||
[ ", FT:" write [ foreign-thread-time>> ] [ total-time>> ] bi percentage. ")" write ]
|
[ [ foreign-thread-time>> ] [ total-time>> ] bi percentage. " " write ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
:: (profile-node.) ( word node depth -- )
|
:: (profile-node.) ( word node depth -- )
|
||||||
node depth times. ": " write word pprint-short nl
|
node times.
|
||||||
|
depth depth.
|
||||||
|
word pprint-short nl
|
||||||
node children>> depth 1 + (profile.) ;
|
node children>> depth 1 + (profile.) ;
|
||||||
|
|
||||||
: (profile.) ( nodes depth -- )
|
: (profile.) ( nodes depth -- )
|
||||||
[ by-total-time ] dip '[ _ (profile-node.) ] assoc-each ;
|
[ by-total-time ] dip '[ _ (profile-node.) ] assoc-each ;
|
||||||
|
|
||||||
|
: profile-heading. ( -- )
|
||||||
|
"depth time ms GC % JIT % FFI % FT %" print ;
|
||||||
|
! NNNN XXXXXXX.X XXXX.X XXXX.X XXXX.X XXXX.X | | foo
|
||||||
: profile. ( tree -- )
|
: profile. ( tree -- )
|
||||||
|
profile-heading.
|
||||||
[ 0 (profile-node.) ] assoc-each ;
|
[ 0 (profile-node.) ] assoc-each ;
|
||||||
|
|
Loading…
Reference in New Issue