From a7ff3833eb46366370377e93337847c5d3d06af1 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 27 Feb 2016 13:40:06 -0500 Subject: eshprof: Show time per call --- (limited to 'eshprof') diff --git a/eshprof/flat-profile.esh b/eshprof/flat-profile.esh index c928b37..571f1d2 100644 --- a/eshprof/flat-profile.esh +++ b/eshprof/flat-profile.esh @@ -164,18 +164,22 @@ show_table() local time= local percent= local calls= + local time_per_call= - printf ' self\n' - printf '%% time seconds calls name\n' + printf ' self self\n' + printf '%% time seconds calls ms/call name\n' for fn in ${fns}; do eval "time=\${fn_timing_${fn}}" + eval "calls=\${fn_calls_${fn}}" percent=$(printf 'scale = 2; 100 * %d / %d\n' \ ${time} ${total_runtime} | bc) time=$(printf 'scale = 9; %d / 1000000000\n' ${time} | bc) - eval "calls=\${fn_calls_${fn}}" + time_per_call=$(printf 'scale = 6; %s * 1000 / %s\n' \ + ${time} ${calls} | bc) printf '%6.2f ' ${percent} printf '%14.9f ' ${time} printf '%8d ' ${calls} + printf '%11.6f ' ${time_per_call} printf '%s\n' "${fn}" done | sort -nr -k 1,4 } -- cgit v0.9.1