aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-07-01 05:12:11 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-21 09:31:55 -0400
commit7ef2efaab4adeabaf0d6a71dfa5651edb517b503 (patch)
treefb59101e2169dfd38a98f989f13801141d29ad01 /tools/perf
parent74c63a25f28350d298f2e529012a49bf6b5fdb46 (diff)
perf c2c report: Add shared cachelines stats stdio output
Display global shared cachelines related stats table as part of the stdio output or when --stats option is speicified: $ perf c2c report --stats ... ================================================= Global Shared Cache Line Event Information ================================================= Total Shared Cache Lines : 1384 Load HITs on shared lines : 5995 Fill Buffer Hits on shared lines : 1726 L1D hits on shared lines : 1943 L2D hits on shared lines : 0 LLC hits on shared lines : 1360 Locked Access on shared lines : 1993 Store HITs on shared lines : 1504 Store L1D hits on shared lines : 1446 Total Merged records : 3527 Original-patch-by: Dick Fowles <rfowles@redhat.com> Original-patch-by: Don Zickus <dzickus@redhat.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.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/n/tip-p0gty8ctbdzisrniwqxhqmhq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-c2c.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 232d5f5ac7a2..f7b118b759cf 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -56,6 +56,10 @@ struct perf_c2c {
56 bool show_src; 56 bool show_src;
57 bool use_stdio; 57 bool use_stdio;
58 bool stats_only; 58 bool stats_only;
59
60 /* HITM shared clines stats */
61 struct c2c_stats hitm_stats;
62 int shared_clines;
59}; 63};
60 64
61static struct perf_c2c c2c; 65static struct perf_c2c c2c;
@@ -1732,6 +1736,39 @@ static int setup_nodes(struct perf_session *session)
1732 return 0; 1736 return 0;
1733} 1737}
1734 1738
1739#define HAS_HITMS(__h) ((__h)->stats.lcl_hitm || (__h)->stats.rmt_hitm)
1740
1741static int resort_hitm_cb(struct hist_entry *he)
1742{
1743 struct c2c_hist_entry *c2c_he;
1744 c2c_he = container_of(he, struct c2c_hist_entry, he);
1745
1746 if (HAS_HITMS(c2c_he)) {
1747 c2c.shared_clines++;
1748 c2c_add_stats(&c2c.hitm_stats, &c2c_he->stats);
1749 }
1750
1751 return 0;
1752}
1753
1754static int hists__iterate_cb(struct hists *hists, hists__resort_cb_t cb)
1755{
1756 struct rb_node *next = rb_first(&hists->entries);
1757 int ret = 0;
1758
1759 while (next) {
1760 struct hist_entry *he;
1761
1762 he = rb_entry(next, struct hist_entry, rb_node);
1763 ret = cb(he);
1764 if (ret)
1765 break;
1766 next = rb_next(&he->rb_node);
1767 }
1768
1769 return ret;
1770}
1771
1735static void print_c2c__display_stats(FILE *out) 1772static void print_c2c__display_stats(FILE *out)
1736{ 1773{
1737 int llc_misses; 1774 int llc_misses;
@@ -1777,6 +1814,26 @@ static void print_c2c__display_stats(FILE *out)
1777 fprintf(out, " Unable to parse data source : %10d\n", stats->noparse); 1814 fprintf(out, " Unable to parse data source : %10d\n", stats->noparse);
1778} 1815}
1779 1816
1817static void print_shared_cacheline_info(FILE *out)
1818{
1819 struct c2c_stats *stats = &c2c.hitm_stats;
1820 int hitm_cnt = stats->lcl_hitm + stats->rmt_hitm;
1821
1822 fprintf(out, "=================================================\n");
1823 fprintf(out, " Global Shared Cache Line Event Information \n");
1824 fprintf(out, "=================================================\n");
1825 fprintf(out, " Total Shared Cache Lines : %10d\n", c2c.shared_clines);
1826 fprintf(out, " Load HITs on shared lines : %10d\n", stats->load);
1827 fprintf(out, " Fill Buffer Hits on shared lines : %10d\n", stats->ld_fbhit);
1828 fprintf(out, " L1D hits on shared lines : %10d\n", stats->ld_l1hit);
1829 fprintf(out, " L2D hits on shared lines : %10d\n", stats->ld_l2hit);
1830 fprintf(out, " LLC hits on shared lines : %10d\n", stats->ld_llchit + stats->lcl_hitm);
1831 fprintf(out, " Locked Access on shared lines : %10d\n", stats->locks);
1832 fprintf(out, " Store HITs on shared lines : %10d\n", stats->store);
1833 fprintf(out, " Store L1D hits on shared lines : %10d\n", stats->st_l1hit);
1834 fprintf(out, " Total Merged records : %10d\n", hitm_cnt + stats->store);
1835}
1836
1780static void print_cacheline(struct c2c_hists *c2c_hists, 1837static void print_cacheline(struct c2c_hists *c2c_hists,
1781 struct hist_entry *he_cl, 1838 struct hist_entry *he_cl,
1782 struct perf_hpp_list *hpp_list, 1839 struct perf_hpp_list *hpp_list,
@@ -1841,6 +1898,8 @@ static void perf_c2c__hists_fprintf(FILE *out)
1841 setup_pager(); 1898 setup_pager();
1842 1899
1843 print_c2c__display_stats(out); 1900 print_c2c__display_stats(out);
1901 fprintf(out, "\n");
1902 print_shared_cacheline_info(out);
1844 1903
1845 if (c2c.stats_only) 1904 if (c2c.stats_only)
1846 return; 1905 return;
@@ -2131,7 +2190,8 @@ static int perf_c2c__report(int argc, const char **argv)
2131 ui_progress__init(&prog, c2c.hists.hists.nr_entries, "Sorting..."); 2190 ui_progress__init(&prog, c2c.hists.hists.nr_entries, "Sorting...");
2132 2191
2133 hists__collapse_resort(&c2c.hists.hists, NULL); 2192 hists__collapse_resort(&c2c.hists.hists, NULL);
2134 hists__output_resort_cb(&c2c.hists.hists, &prog, resort_cl_cb); 2193 hists__output_resort_cb(&c2c.hists.hists, &prog, resort_hitm_cb);
2194 hists__iterate_cb(&c2c.hists.hists, resort_cl_cb);
2135 2195
2136 ui_progress__finish(); 2196 ui_progress__finish();
2137 2197