Commit 7ef2efaa authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarDick Fowles <rfowles@redhat.com>
Original-patch-by: default avatarDon Zickus <dzickus@redhat.com>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 74c63a25
...@@ -56,6 +56,10 @@ struct perf_c2c { ...@@ -56,6 +56,10 @@ struct perf_c2c {
bool show_src; bool show_src;
bool use_stdio; bool use_stdio;
bool stats_only; bool stats_only;
/* HITM shared clines stats */
struct c2c_stats hitm_stats;
int shared_clines;
}; };
static struct perf_c2c c2c; static struct perf_c2c c2c;
...@@ -1732,6 +1736,39 @@ static int setup_nodes(struct perf_session *session) ...@@ -1732,6 +1736,39 @@ static int setup_nodes(struct perf_session *session)
return 0; return 0;
} }
#define HAS_HITMS(__h) ((__h)->stats.lcl_hitm || (__h)->stats.rmt_hitm)
static int resort_hitm_cb(struct hist_entry *he)
{
struct c2c_hist_entry *c2c_he;
c2c_he = container_of(he, struct c2c_hist_entry, he);
if (HAS_HITMS(c2c_he)) {
c2c.shared_clines++;
c2c_add_stats(&c2c.hitm_stats, &c2c_he->stats);
}
return 0;
}
static int hists__iterate_cb(struct hists *hists, hists__resort_cb_t cb)
{
struct rb_node *next = rb_first(&hists->entries);
int ret = 0;
while (next) {
struct hist_entry *he;
he = rb_entry(next, struct hist_entry, rb_node);
ret = cb(he);
if (ret)
break;
next = rb_next(&he->rb_node);
}
return ret;
}
static void print_c2c__display_stats(FILE *out) static void print_c2c__display_stats(FILE *out)
{ {
int llc_misses; int llc_misses;
...@@ -1777,6 +1814,26 @@ static void print_c2c__display_stats(FILE *out) ...@@ -1777,6 +1814,26 @@ static void print_c2c__display_stats(FILE *out)
fprintf(out, " Unable to parse data source : %10d\n", stats->noparse); fprintf(out, " Unable to parse data source : %10d\n", stats->noparse);
} }
static void print_shared_cacheline_info(FILE *out)
{
struct c2c_stats *stats = &c2c.hitm_stats;
int hitm_cnt = stats->lcl_hitm + stats->rmt_hitm;
fprintf(out, "=================================================\n");
fprintf(out, " Global Shared Cache Line Event Information \n");
fprintf(out, "=================================================\n");
fprintf(out, " Total Shared Cache Lines : %10d\n", c2c.shared_clines);
fprintf(out, " Load HITs on shared lines : %10d\n", stats->load);
fprintf(out, " Fill Buffer Hits on shared lines : %10d\n", stats->ld_fbhit);
fprintf(out, " L1D hits on shared lines : %10d\n", stats->ld_l1hit);
fprintf(out, " L2D hits on shared lines : %10d\n", stats->ld_l2hit);
fprintf(out, " LLC hits on shared lines : %10d\n", stats->ld_llchit + stats->lcl_hitm);
fprintf(out, " Locked Access on shared lines : %10d\n", stats->locks);
fprintf(out, " Store HITs on shared lines : %10d\n", stats->store);
fprintf(out, " Store L1D hits on shared lines : %10d\n", stats->st_l1hit);
fprintf(out, " Total Merged records : %10d\n", hitm_cnt + stats->store);
}
static void print_cacheline(struct c2c_hists *c2c_hists, static void print_cacheline(struct c2c_hists *c2c_hists,
struct hist_entry *he_cl, struct hist_entry *he_cl,
struct perf_hpp_list *hpp_list, struct perf_hpp_list *hpp_list,
...@@ -1841,6 +1898,8 @@ static void perf_c2c__hists_fprintf(FILE *out) ...@@ -1841,6 +1898,8 @@ static void perf_c2c__hists_fprintf(FILE *out)
setup_pager(); setup_pager();
print_c2c__display_stats(out); print_c2c__display_stats(out);
fprintf(out, "\n");
print_shared_cacheline_info(out);
if (c2c.stats_only) if (c2c.stats_only)
return; return;
...@@ -2131,7 +2190,8 @@ static int perf_c2c__report(int argc, const char **argv) ...@@ -2131,7 +2190,8 @@ static int perf_c2c__report(int argc, const char **argv)
ui_progress__init(&prog, c2c.hists.hists.nr_entries, "Sorting..."); ui_progress__init(&prog, c2c.hists.hists.nr_entries, "Sorting...");
hists__collapse_resort(&c2c.hists.hists, NULL); hists__collapse_resort(&c2c.hists.hists, NULL);
hists__output_resort_cb(&c2c.hists.hists, &prog, resort_cl_cb); hists__output_resort_cb(&c2c.hists.hists, &prog, resort_hitm_cb);
hists__iterate_cb(&c2c.hists.hists, resort_cl_cb);
ui_progress__finish(); ui_progress__finish();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment