lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1476975876-2522-36-git-send-email-acme@kernel.org>
Date:   Thu, 20 Oct 2016 12:04:19 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     linux-kernel@...r.kernel.org, Linux Weekly News <lwn@....net>,
        Jiri Olsa <jolsa@...nel.org>, Andi Kleen <andi@...stfloor.org>,
        David Ahern <dsahern@...il.com>,
        Don Zickus <dzickus@...hat.com>, Joe Mario <jmario@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 35/52] perf c2c report: Add stdio output support

From: Jiri Olsa <jolsa@...nel.org>

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@...nel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Andi Kleen <andi@...stfloor.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Don Zickus <dzickus@...hat.com>
Cc: Joe Mario <jmario@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/n/tip-eorco9r0oeesjve77pkkg43s@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-c2c.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

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 @@
 #include "tool.h"
 #include "data.h"
 #include "sort.h"
+#include <asm/bug.h>
 
 struct c2c_hists {
 	struct hists		hists;
@@ -1722,6 +1723,85 @@ static int setup_nodes(struct perf_session *session)
 	return 0;
 }
 
+static void print_cacheline(struct c2c_hists *c2c_hists,
+			    struct hist_entry *he_cl,
+			    struct perf_hpp_list *hpp_list,
+			    FILE *out)
+{
+	char bf[1000];
+	struct perf_hpp hpp = {
+		.buf            = bf,
+		.size           = 1000,
+	};
+	static bool once;
+
+	if (!once) {
+		hists__fprintf_headers(&c2c_hists->hists, out);
+		once = true;
+	} else {
+		fprintf(out, "\n");
+	}
+
+	fprintf(out, "  ------------------------------------------------------\n");
+	__hist_entry__snprintf(he_cl, &hpp, hpp_list);
+	fprintf(out, "%s\n", bf);
+	fprintf(out, "  ------------------------------------------------------\n");
+
+	hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, true);
+}
+
+static void print_pareto(FILE *out)
+{
+	struct perf_hpp_list hpp_list;
+	struct rb_node *nd;
+	int ret;
+
+	perf_hpp_list__init(&hpp_list);
+	ret = hpp_list__parse(&hpp_list,
+				"cl_rmt_hitm,"
+				"cl_lcl_hitm,"
+				"cl_stores_l1hit,"
+				"cl_stores_l1miss,"
+				"dcacheline",
+				NULL);
+
+	if (WARN_ONCE(ret, "failed to setup sort entries\n"))
+		return;
+
+	nd = rb_first(&c2c.hists.hists.entries);
+
+	for (; nd; nd = rb_next(nd)) {
+		struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
+		struct c2c_hist_entry *c2c_he;
+
+		if (he->filtered)
+			continue;
+
+		c2c_he = container_of(he, struct c2c_hist_entry, he);
+		print_cacheline(c2c_he->hists, he, &hpp_list, out);
+	}
+}
+
+static void perf_c2c__hists_fprintf(FILE *out)
+{
+	setup_pager();
+
+	fprintf(out, "\n");
+	fprintf(out, "=================================================\n");
+	fprintf(out, "           Shared Data Cache Line Table          \n");
+	fprintf(out, "=================================================\n");
+	fprintf(out, "#\n");
+
+	hists__fprintf(&c2c.hists.hists, true, 0, 0, 0, stdout, false);
+
+	fprintf(out, "\n");
+	fprintf(out, "=================================================\n");
+	fprintf(out, "      Shared Cache Line Distribution Pareto      \n");
+	fprintf(out, "=================================================\n");
+	fprintf(out, "#\n");
+
+	print_pareto(out);
+}
 
 static int perf_c2c__report(int argc, const char **argv)
 {
@@ -1806,6 +1886,9 @@ static int perf_c2c__report(int argc, const char **argv)
 
 	ui_progress__finish();
 
+	use_browser = 0;
+	perf_c2c__hists_fprintf(stdout);
+
 out_session:
 	perf_session__delete(session);
 out:
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ