summaryrefslogtreecommitdiffstats
path: root/eshprof/flat-profile.esh
diff options
context:
space:
mode:
Diffstat (limited to 'eshprof/flat-profile.esh')
-rw-r--r--eshprof/flat-profile.esh10
1 files changed, 7 insertions, 3 deletions
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
}