aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-24 15:29:22 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-24 15:29:22 +0200
commit7ff8f81d2569ed79817fec2beddbe75c46273f40 (patch)
tree76c96ff2a5979cf36484c34f57b2e6a4baebcaca /lib/tools
parente8bb08d1332e7d3a2f41caa15f4155920325e2ac (diff)
parente166f245984d424340ca3b27e2152808b4d13d29 (diff)
downloadotp-7ff8f81d2569ed79817fec2beddbe75c46273f40.tar.gz
otp-7ff8f81d2569ed79817fec2beddbe75c46273f40.tar.bz2
otp-7ff8f81d2569ed79817fec2beddbe75c46273f40.zip
Merge branch 'egil/eprof-totality/OTP-12681'
* egil/eprof-totality/OTP-12681: tools: Add printout of total number of calls and time in eprof
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/src/eprof.erl24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/tools/src/eprof.erl b/lib/tools/src/eprof.erl
index a3fef91e61..28cf493a5f 100644
--- a/lib/tools/src/eprof.erl
+++ b/lib/tools/src/eprof.erl
@@ -485,20 +485,22 @@ string_bp_mfa([{Mfa, {Count, Time}}|Mfas], Tus, {MfaW, CountW, PercW, TimeW, TpC
erlang:max(TpCW, length(Stpc))
}, [[Smfa, Scount, Sperc, Stime, Stpc] | Strings]).
-print_bp_mfa(Mfas, {_Tn, Tus}, Fd, Opts) ->
+print_bp_mfa(Mfas, {Tn, Tus}, Fd, Opts) ->
Fmfas = filter_mfa(sort_mfa(Mfas, proplists:get_value(sort, Opts)), proplists:get_value(filter, Opts)),
{{MfaW, CountW, PercW, TimeW, TpCW}, Strs} = string_bp_mfa(Fmfas, Tus),
- Ws = {
- erlang:max(length("FUNCTION"), MfaW),
- erlang:max(length("CALLS"), CountW),
- erlang:max(length(" %"), PercW),
- erlang:max(length("TIME"), TimeW),
- erlang:max(length("uS / CALLS"), TpCW)
- },
- format(Fd, Ws, ["FUNCTION", "CALLS", " %", "TIME", "uS / CALLS"]),
- format(Fd, Ws, ["--------", "-----", "---", "----", "----------"]),
-
+ TnStr = s(Tn),
+ TusStr = s(Tus),
+ TuspcStr = s("~.2f", [divide(Tus,Tn)]),
+ Ws = {erlang:max(length("FUNCTION"), MfaW),
+ lists:max([length("CALLS"), CountW, length(TnStr)]),
+ erlang:max(length(" %"), PercW),
+ lists:max([length("TIME"), TimeW, length(TusStr)]),
+ lists:max([length("uS / CALLS"), TpCW, length(TuspcStr)])},
+ format(Fd, Ws, ["FUNCTION", "CALLS", " %", "TIME", "uS / CALLS"]),
+ format(Fd, Ws, ["--------", "-----", "-------", "----", "----------"]),
lists:foreach(fun (String) -> format(Fd, Ws, String) end, Strs),
+ format(Fd, Ws, [lists:duplicate(N,$-)||N <- tuple_to_list(Ws)]),
+ format(Fd, Ws, ["Total:", TnStr, "100.00%", TusStr, TuspcStr]),
ok.
s({M,F,A}) -> s("~w:~w/~w",[M,F,A]);