perf stat: Print stalled cycles percentage
Commit-ID: 11ba2b85f506306c8dfc9fe144aa4ddc43242855 Gitweb: http://git.kernel.org/tip/11ba2b85f506306c8dfc9fe144aa4ddc43242855 Author: Ingo Molnar <[email protected]> AuthorDate: Sun, 24 Apr 2011 15:05:10 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 26 Apr 2011 20:04:54 +0200
perf stat: Print stalled cycles percentage
Print:
611,527 cycles
400,553 instructions # ( 0.71 instructions per cycle )
77,809 stalled-cycles # ( 12.71% of all cycles )
0.000610987 seconds time elapsedAcked-by Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- tools/perf/builtin-stat.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
tools/perf/builtin-stat.c +9 -2
@@ -442,7 +442,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)if (total) ratio = avg / total; -fprintf (stderr," # %10.3f IPC " , ratio); +fprintf (stderr," # ( %4.2f instructions per cycle )" , ratio); }else if (perf_evsel__match (evsel,HARDWARE ,HW_BRANCH_MISSES ) && runtime_branches_stats[cpu].n !=0 ) { total =avg_stats (&runtime_branches_stats[cpu]);
@@ -450,7 +450,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)if (total) ratio = avg *100 / total; -fprintf (stderr," # %10.3f %% " , ratio); +fprintf (stderr," # %10.3f %%" , ratio); }else if (runtime_nsecs_stats[cpu].n !=0 ) { total =avg_stats (&runtime_nsecs_stats[cpu]);
@@ -459,6 +459,13 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg) ratio =1000.0 * avg / total;fprintf (stderr," # %10.3f M/sec" , ratio); + }else if (perf_evsel__match (evsel,HARDWARE ,HW_STALLED_CYCLES )) { + total =avg_stats (&runtime_cycles_stats[cpu]); + +if (total) + ratio = avg / total *100.0 ; + +fprintf (stderr," # (%5.2f%% of all cycles )" , ratio); } }