aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-stat.c72
1 files changed, 39 insertions, 33 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index fc85e6b9bd13..2ff2e22aa140 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1059,43 +1059,11 @@ static void print_ll_cache_misses(int cpu,
1059 fprintf(output, " of all LL-cache hits "); 1059 fprintf(output, " of all LL-cache hits ");
1060} 1060}
1061 1061
1062static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg) 1062static void print_shadow_stats(struct perf_evsel *evsel, double avg, int cpu)
1063{ 1063{
1064 double total, ratio = 0.0, total2; 1064 double total, ratio = 0.0, total2;
1065 double sc = evsel->scale;
1066 const char *fmt;
1067 int cpu = cpu_map__id_to_cpu(id);
1068 int ctx = evsel_context(evsel); 1065 int ctx = evsel_context(evsel);
1069 1066
1070 if (csv_output) {
1071 fmt = sc != 1.0 ? "%.2f%s" : "%.0f%s";
1072 } else {
1073 if (big_num)
1074 fmt = sc != 1.0 ? "%'18.2f%s" : "%'18.0f%s";
1075 else
1076 fmt = sc != 1.0 ? "%18.2f%s" : "%18.0f%s";
1077 }
1078
1079 aggr_printout(evsel, id, nr);
1080
1081 if (aggr_mode == AGGR_GLOBAL)
1082 cpu = 0;
1083
1084 fprintf(output, fmt, avg, csv_sep);
1085
1086 if (evsel->unit)
1087 fprintf(output, "%-*s%s",
1088 csv_output ? 0 : unit_width,
1089 evsel->unit, csv_sep);
1090
1091 fprintf(output, "%-*s", csv_output ? 0 : 25, perf_evsel__name(evsel));
1092
1093 if (evsel->cgrp)
1094 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
1095
1096 if (csv_output || interval)
1097 return;
1098
1099 if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) { 1067 if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
1100 total = avg_stats(&runtime_cycles_stats[ctx][cpu]); 1068 total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
1101 if (total) { 1069 if (total) {
@@ -1226,6 +1194,44 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
1226 } 1194 }
1227} 1195}
1228 1196
1197static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
1198{
1199 double sc = evsel->scale;
1200 const char *fmt;
1201 int cpu = cpu_map__id_to_cpu(id);
1202
1203 if (csv_output) {
1204 fmt = sc != 1.0 ? "%.2f%s" : "%.0f%s";
1205 } else {
1206 if (big_num)
1207 fmt = sc != 1.0 ? "%'18.2f%s" : "%'18.0f%s";
1208 else
1209 fmt = sc != 1.0 ? "%18.2f%s" : "%18.0f%s";
1210 }
1211
1212 aggr_printout(evsel, id, nr);
1213
1214 if (aggr_mode == AGGR_GLOBAL)
1215 cpu = 0;
1216
1217 fprintf(output, fmt, avg, csv_sep);
1218
1219 if (evsel->unit)
1220 fprintf(output, "%-*s%s",
1221 csv_output ? 0 : unit_width,
1222 evsel->unit, csv_sep);
1223
1224 fprintf(output, "%-*s", csv_output ? 0 : 25, perf_evsel__name(evsel));
1225
1226 if (evsel->cgrp)
1227 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
1228
1229 if (csv_output || interval)
1230 return;
1231
1232 print_shadow_stats(evsel, avg, cpu);
1233}
1234
1229static void print_aggr(char *prefix) 1235static void print_aggr(char *prefix)
1230{ 1236{
1231 struct perf_evsel *counter; 1237 struct perf_evsel *counter;