aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-11-21 16:33:30 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-23 08:44:05 -0500
commitd940baccc990c29f0343843db7cf669bb8e91a6f (patch)
tree0a5c67601f1da82c88cf0e68ca5bde602478f3e3 /tools
parentdba8ab93792a3a864ff741efe435b2ecbdfb66b1 (diff)
perf c2c report: Display total HITMs on default
Currently we display the cacheline list sorted on remote HITMs by default. The problem is that they might not be always counted and 'perf c2c report' displays an empty output. Thus it's more convenient to display and sort the cacheline list based on the total of HITMs and have the best change to see data in the default report run. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Joe Mario <jmario@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1479764011-10732-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-c2c.txt4
-rw-r--r--tools/perf/builtin-c2c.c39
2 files changed, 36 insertions, 7 deletions
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt
index 5eda9336267e..3f06730c7f47 100644
--- a/tools/perf/Documentation/perf-c2c.txt
+++ b/tools/perf/Documentation/perf-c2c.txt
@@ -104,6 +104,10 @@ REPORT OPTIONS
104--force:: 104--force::
105 Don't do ownership validation. 105 Don't do ownership validation.
106 106
107-d::
108--display::
109 Siwtch to HITM type (rmt, lcl) to display and sort on. Total HITMs as default.
110
107C2C RECORD 111C2C RECORD
108---------- 112----------
109The perf c2c record command setup options related to HITM cacheline analysis 113The perf c2c record command setup options related to HITM cacheline analysis
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index d873977b8fb6..54924717ae8e 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -91,6 +91,14 @@ struct perf_c2c {
91enum { 91enum {
92 DISPLAY_LCL, 92 DISPLAY_LCL,
93 DISPLAY_RMT, 93 DISPLAY_RMT,
94 DISPLAY_TOT,
95 DISPLAY_MAX,
96};
97
98static const char *display_str[DISPLAY_MAX] = {
99 [DISPLAY_LCL] = "Local",
100 [DISPLAY_RMT] = "Remote",
101 [DISPLAY_TOT] = "Total",
94}; 102};
95 103
96static struct perf_c2c c2c; 104static struct perf_c2c c2c;
@@ -745,6 +753,10 @@ static double percent_hitm(struct c2c_hist_entry *c2c_he)
745 case DISPLAY_LCL: 753 case DISPLAY_LCL:
746 st = stats->lcl_hitm; 754 st = stats->lcl_hitm;
747 tot = total->lcl_hitm; 755 tot = total->lcl_hitm;
756 break;
757 case DISPLAY_TOT:
758 st = stats->tot_hitm;
759 tot = total->tot_hitm;
748 default: 760 default:
749 break; 761 break;
750 } 762 }
@@ -1044,6 +1056,9 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
1044 break; 1056 break;
1045 case DISPLAY_LCL: 1057 case DISPLAY_LCL:
1046 DISPLAY_HITM(lcl_hitm); 1058 DISPLAY_HITM(lcl_hitm);
1059 break;
1060 case DISPLAY_TOT:
1061 DISPLAY_HITM(tot_hitm);
1047 default: 1062 default:
1048 break; 1063 break;
1049 } 1064 }
@@ -1351,6 +1366,7 @@ static struct c2c_dimension dim_tot_loads = {
1351static struct c2c_header percent_hitm_header[] = { 1366static struct c2c_header percent_hitm_header[] = {
1352 [DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"), 1367 [DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"),
1353 [DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"), 1368 [DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"),
1369 [DISPLAY_TOT] = HEADER_BOTH("Tot", "Hitm"),
1354}; 1370};
1355 1371
1356static struct c2c_dimension dim_percent_hitm = { 1372static struct c2c_dimension dim_percent_hitm = {
@@ -1794,6 +1810,9 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats)
1794 break; 1810 break;
1795 case DISPLAY_RMT: 1811 case DISPLAY_RMT:
1796 FILTER_HITM(rmt_hitm); 1812 FILTER_HITM(rmt_hitm);
1813 break;
1814 case DISPLAY_TOT:
1815 FILTER_HITM(tot_hitm);
1797 default: 1816 default:
1798 break; 1817 break;
1799 }; 1818 };
@@ -1809,8 +1828,9 @@ static inline int valid_hitm_or_store(struct hist_entry *he)
1809 bool has_hitm; 1828 bool has_hitm;
1810 1829
1811 c2c_he = container_of(he, struct c2c_hist_entry, he); 1830 c2c_he = container_of(he, struct c2c_hist_entry, he);
1812 has_hitm = c2c.display == DISPLAY_LCL ? 1831 has_hitm = c2c.display == DISPLAY_TOT ? c2c_he->stats.tot_hitm :
1813 c2c_he->stats.lcl_hitm : c2c_he->stats.rmt_hitm; 1832 c2c.display == DISPLAY_LCL ? c2c_he->stats.lcl_hitm :
1833 c2c_he->stats.rmt_hitm;
1814 return has_hitm || c2c_he->stats.store; 1834 return has_hitm || c2c_he->stats.store;
1815} 1835}
1816 1836
@@ -2095,7 +2115,7 @@ static void print_c2c_info(FILE *out, struct perf_session *session)
2095 first = false; 2115 first = false;
2096 } 2116 }
2097 fprintf(out, " Cachelines sort on : %s HITMs\n", 2117 fprintf(out, " Cachelines sort on : %s HITMs\n",
2098 c2c.display == DISPLAY_LCL ? "Local" : "Remote"); 2118 display_str[c2c.display]);
2099 fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort); 2119 fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort);
2100} 2120}
2101 2121
@@ -2250,7 +2270,7 @@ static int perf_c2c_browser__title(struct hist_browser *browser,
2250 "Shared Data Cache Line Table " 2270 "Shared Data Cache Line Table "
2251 "(%lu entries, sorted on %s HITMs)", 2271 "(%lu entries, sorted on %s HITMs)",
2252 browser->nr_non_filtered_entries, 2272 browser->nr_non_filtered_entries,
2253 c2c.display == DISPLAY_LCL ? "local" : "remote"); 2273 display_str[c2c.display]);
2254 return 0; 2274 return 0;
2255} 2275}
2256 2276
@@ -2387,9 +2407,11 @@ static int setup_callchain(struct perf_evlist *evlist)
2387 2407
2388static int setup_display(const char *str) 2408static int setup_display(const char *str)
2389{ 2409{
2390 const char *display = str ?: "rmt"; 2410 const char *display = str ?: "tot";
2391 2411
2392 if (!strcmp(display, "rmt")) 2412 if (!strcmp(display, "tot"))
2413 c2c.display = DISPLAY_TOT;
2414 else if (!strcmp(display, "rmt"))
2393 c2c.display = DISPLAY_RMT; 2415 c2c.display = DISPLAY_RMT;
2394 else if (!strcmp(display, "lcl")) 2416 else if (!strcmp(display, "lcl"))
2395 c2c.display = DISPLAY_LCL; 2417 c2c.display = DISPLAY_LCL;
@@ -2474,6 +2496,8 @@ static int setup_coalesce(const char *coalesce, bool no_source)
2474 return -1; 2496 return -1;
2475 2497
2476 if (asprintf(&c2c.cl_resort, "offset,%s", 2498 if (asprintf(&c2c.cl_resort, "offset,%s",
2499 c2c.display == DISPLAY_TOT ?
2500 "tot_hitm" :
2477 c2c.display == DISPLAY_RMT ? 2501 c2c.display == DISPLAY_RMT ?
2478 "rmt_hitm,lcl_hitm" : 2502 "rmt_hitm,lcl_hitm" :
2479 "lcl_hitm,rmt_hitm") < 0) 2503 "lcl_hitm,rmt_hitm") < 0)
@@ -2520,7 +2544,7 @@ static int perf_c2c__report(int argc, const char **argv)
2520 "print_type,threshold[,print_limit],order,sort_key[,branch],value", 2544 "print_type,threshold[,print_limit],order,sort_key[,branch],value",
2521 callchain_help, &parse_callchain_opt, 2545 callchain_help, &parse_callchain_opt,
2522 callchain_default_opt), 2546 callchain_default_opt),
2523 OPT_STRING('d', "display", &display, NULL, "lcl,rmt"), 2547 OPT_STRING('d', "display", &display, "Switch HITM output type", "lcl,rmt"),
2524 OPT_STRING('c', "coalesce", &coalesce, "coalesce fields", 2548 OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
2525 "coalesce fields: pid,tid,iaddr,dso"), 2549 "coalesce fields: pid,tid,iaddr,dso"),
2526 OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"), 2550 OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
@@ -2608,6 +2632,7 @@ static int perf_c2c__report(int argc, const char **argv)
2608 "tot_loads," 2632 "tot_loads,"
2609 "ld_fbhit,ld_l1hit,ld_l2hit," 2633 "ld_fbhit,ld_l1hit,ld_l2hit,"
2610 "ld_lclhit,ld_rmthit", 2634 "ld_lclhit,ld_rmthit",
2635 c2c.display == DISPLAY_TOT ? "tot_hitm" :
2611 c2c.display == DISPLAY_LCL ? "lcl_hitm" : "rmt_hitm" 2636 c2c.display == DISPLAY_LCL ? "lcl_hitm" : "rmt_hitm"
2612 ); 2637 );
2613 2638