mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 17:23:55 +08:00
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>
This commit is contained in:
parent
22dd59d145
commit
2d388bd0c9
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user