aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-05-03 08:32:56 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-19 12:18:31 -0400
commit2d388bd0c9d3e3fed9e4abdd9aadf2f07e9cf755 (patch)
treeb465888562fc595cc4ca2afd1ef4e0ec756790a1 /tools/perf
parent22dd59d1457408b69a95e2b5487a500f39d3c409 (diff)
perf c2c report: Add stdio output support
Adding the --stdio option output support. The output tables are dumped directly to the stdio. $ perf c2c report ================================================= Shared Data Cache Line Table ================================================= # # Total ----- LLC Load Hitm ----- ---- Store Reference ---- --- Load Dram ---- LLC Total ----- Core Load Hit ----- -- LLC Load Hit -- # Cacheline records %hitm Total Lcl Rmt Total L1Hit L1Miss Lcl Rmt Ld Miss Loads FB L1 L2 Llc Rmt # .................. ....... ....... ....... ....... ....... ....... ....... ....... ........ ........ ....... ....... ....... ....... ....... ........ ........ # 0xffff88000235f840 17 0.00% 0 0 0 17 17 0 0 0 0 0 0 0 0 0 0 ... ================================================= Shared Cache Line Distribution Pareto ================================================= # # ----- HITM ----- -- Store Refs -- Data address ---------- cycles ---------- cpu Shared # Rmt Lcl L1 Hit L1 Miss Offset Pid Tid rmt hitm lcl hitm load cnt Symbol Object Node # ....... ....... ....... ....... .................. ....... ..................... ........ ........ ........ ........ .................... ................. .... # ------------------------------------------------------ 0 0 17 0 0xffff88000235f840 ------------------------------------------------------ 0.00% 0.00% 5.88% 0.00% 0x0 11474 11474:kworker/u16:5 0 0 0 1 [k] rmap_walk_file [kernel.kallsyms] 0 0.00% 0.00% 5.88% 0.00% 0x10 11474 11474:kworker/u16:5 0 0 0 1 [k] lock_page_memcg [kernel.kallsyms] 0 0.00% 0.00% 11.76% 0.00% 0x20 11474 11474:kworker/u16:5 0 0 0 1 [k] page_mapping [kernel.kallsyms] 0 0.00% 0.00% 64.71% 0.00% 0x28 11474 11474:kworker/u16:5 0 0 0 1 [k] __test_set_page_writeback [kernel.kallsyms] 0 0.00% 0.00% 11.76% 0.00% 0x30 11474 11474:kworker/u16:5 0 0 0 1 [k] page_mapped [kernel.kallsyms] 0 ... 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: 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/n/tip-eorco9r0oeesjve77pkkg43s@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.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c271261fcaf1..33db26c6ca63 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -13,6 +13,7 @@
13#include "tool.h" 13#include "tool.h"
14#include "data.h" 14#include "data.h"
15#include "sort.h" 15#include "sort.h"
16#include <asm/bug.h>
16 17
17struct c2c_hists { 18struct c2c_hists {
18 struct hists hists; 19 struct hists hists;
@@ -1722,6 +1723,85 @@ static int setup_nodes(struct perf_session *session)
1722 return 0; 1723 return 0;
1723} 1724}
1724 1725
1726static void print_cacheline(struct c2c_hists *c2c_hists,
1727 struct hist_entry *he_cl,
1728 struct perf_hpp_list *hpp_list,
1729 FILE *out)
1730{
1731 char bf[1000];
1732 struct perf_hpp hpp = {
1733 .buf = bf,
1734 .size = 1000,
1735 };
1736 static bool once;
1737
1738 if (!once) {
1739 hists__fprintf_headers(&c2c_hists->hists, out);
1740 once = true;
1741 } else {
1742 fprintf(out, "\n");
1743 }
1744
1745 fprintf(out, " ------------------------------------------------------\n");
1746 __hist_entry__snprintf(he_cl, &hpp, hpp_list);
1747 fprintf(out, "%s\n", bf);
1748 fprintf(out, " ------------------------------------------------------\n");
1749
1750 hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, true);
1751}
1752
1753static void print_pareto(FILE *out)
1754{
1755 struct perf_hpp_list hpp_list;
1756 struct rb_node *nd;
1757 int ret;
1758
1759 perf_hpp_list__init(&hpp_list);
1760 ret = hpp_list__parse(&hpp_list,
1761 "cl_rmt_hitm,"
1762 "cl_lcl_hitm,"
1763 "cl_stores_l1hit,"
1764 "cl_stores_l1miss,"
1765 "dcacheline",
1766 NULL);
1767
1768 if (WARN_ONCE(ret, "failed to setup sort entries\n"))
1769 return;
1770
1771 nd = rb_first(&c2c.hists.hists.entries);
1772
1773 for (; nd; nd = rb_next(nd)) {
1774 struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
1775 struct c2c_hist_entry *c2c_he;
1776
1777 if (he->filtered)
1778 continue;
1779
1780 c2c_he = container_of(he, struct c2c_hist_entry, he);
1781 print_cacheline(c2c_he->hists, he, &hpp_list, out);
1782 }
1783}
1784
1785static void perf_c2c__hists_fprintf(FILE *out)
1786{
1787 setup_pager();
1788
1789 fprintf(out, "\n");
1790 fprintf(out, "=================================================\n");
1791 fprintf(out, " Shared Data Cache Line Table \n");
1792 fprintf(out, "=================================================\n");
1793 fprintf(out, "#\n");
1794
1795 hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, false);
1796
1797 fprintf(out, "\n");
1798 fprintf(out, "=================================================\n");
1799 fprintf(out, " Shared Cache Line Distribution Pareto \n");
1800 fprintf(out, "=================================================\n");
1801 fprintf(out, "#\n");
1802
1803 print_pareto(out);
1804}
1725 1805
1726static int perf_c2c__report(int argc, const char **argv) 1806static int perf_c2c__report(int argc, const char **argv)
1727{ 1807{
@@ -1806,6 +1886,9 @@ static int perf_c2c__report(int argc, const char **argv)
1806 1886
1807 ui_progress__finish(); 1887 ui_progress__finish();
1808 1888
1889 use_browser = 0;
1890 perf_c2c__hists_fprintf(stdout);
1891
1809out_session: 1892out_session:
1810 perf_session__delete(session); 1893 perf_session__delete(session);
1811out: 1894out: