lkml.org 
[lkml]   [2022]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 05/11] perf c2c: Add dimensions for peer load operations
Date
This patch is to add dimensions for peer load operations, include a
dimension for the total statistics for metric 'ld_peer', and also add
dimensions for the single cache line view.

Same as HTIM metrics, this patch also adds the dimension for mean value
for peer load operations.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Ali Saidi <alisaidi@amazon.com>
---
tools/perf/builtin-c2c.c | 87 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c8230c48125f..b0695cfe793f 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -55,6 +55,7 @@ struct c2c_hists {
struct compute_stats {
struct stats lcl_hitm;
struct stats rmt_hitm;
+ struct stats ld_peer;
struct stats load;
};

@@ -154,6 +155,7 @@ static void *c2c_he_zalloc(size_t size)

init_stats(&c2c_he->cstats.lcl_hitm);
init_stats(&c2c_he->cstats.rmt_hitm);
+ init_stats(&c2c_he->cstats.ld_peer);
init_stats(&c2c_he->cstats.load);

return &c2c_he->he;
@@ -253,6 +255,8 @@ static void compute_stats(struct c2c_hist_entry *c2c_he,
update_stats(&cstats->rmt_hitm, weight);
else if (stats->lcl_hitm)
update_stats(&cstats->lcl_hitm, weight);
+ else if (stats->ld_peer)
+ update_stats(&cstats->ld_peer, weight);
else if (stats->load)
update_stats(&cstats->load, weight);
}
@@ -658,6 +662,7 @@ STAT_FN(ld_fbhit)
STAT_FN(ld_l1hit)
STAT_FN(ld_l2hit)
STAT_FN(ld_llchit)
+STAT_FN(ld_peer)
STAT_FN(rmt_hit)

static uint64_t total_records(struct c2c_stats *stats)
@@ -899,6 +904,7 @@ static double percent_ ## __f(struct c2c_hist_entry *c2c_he) \

PERCENT_FN(rmt_hitm)
PERCENT_FN(lcl_hitm)
+PERCENT_FN(ld_peer)
PERCENT_FN(st_l1hit)
PERCENT_FN(st_l1miss)
PERCENT_FN(st_na)
@@ -965,6 +971,37 @@ percent_lcl_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
return per_left - per_right;
}

+static int
+percent_ld_peer_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
+ struct hist_entry *he)
+{
+ int width = c2c_width(fmt, hpp, he->hists);
+ double per = PERCENT(he, ld_peer);
+ char buf[10];
+
+ return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per));
+}
+
+static int
+percent_ld_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
+ struct hist_entry *he)
+{
+ return percent_color(fmt, hpp, he, percent_ld_peer);
+}
+
+static int64_t
+percent_ld_peer_cmp(struct perf_hpp_fmt *fmt __maybe_unused,
+ struct hist_entry *left, struct hist_entry *right)
+{
+ double per_left;
+ double per_right;
+
+ per_left = PERCENT(left, ld_peer);
+ per_right = PERCENT(right, ld_peer);
+
+ return per_left - per_right;
+}
+
static int
percent_stores_l1hit_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
struct hist_entry *he)
@@ -1213,6 +1250,7 @@ __func(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) \
MEAN_ENTRY(mean_rmt_entry, rmt_hitm);
MEAN_ENTRY(mean_lcl_entry, lcl_hitm);
MEAN_ENTRY(mean_load_entry, load);
+MEAN_ENTRY(mean_peer_entry, ld_peer);

static int
cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
@@ -1360,6 +1398,14 @@ static struct c2c_dimension dim_rmt_hitm = {
.width = 7,
};

+static struct c2c_dimension dim_ld_peer = {
+ .header = HEADER_BOTH("Snoop", "Peer"),
+ .name = "ld_peer",
+ .cmp = ld_peer_cmp,
+ .entry = ld_peer_entry,
+ .width = 7,
+};
+
static struct c2c_dimension dim_cl_rmt_hitm = {
.header = HEADER_SPAN("----- HITM -----", "Rmt", 1),
.name = "cl_rmt_hitm",
@@ -1376,6 +1422,14 @@ static struct c2c_dimension dim_cl_lcl_hitm = {
.width = 7,
};

+static struct c2c_dimension dim_cl_ld_peer = {
+ .header = HEADER_BOTH("Snoop", "Peer"),
+ .name = "cl_ld_peer",
+ .cmp = ld_peer_cmp,
+ .entry = ld_peer_entry,
+ .width = 7,
+};
+
static struct c2c_dimension dim_tot_stores = {
.header = HEADER_BOTH("Total", "Stores"),
.name = "tot_stores",
@@ -1520,6 +1574,15 @@ static struct c2c_dimension dim_percent_lcl_hitm = {
.width = 7,
};

+static struct c2c_dimension dim_percent_ld_peer = {
+ .header = HEADER_BOTH("Snoop", "Peer"),
+ .name = "percent_ld_peer",
+ .cmp = percent_ld_peer_cmp,
+ .entry = percent_ld_peer_entry,
+ .color = percent_ld_peer_color,
+ .width = 7,
+};
+
static struct c2c_dimension dim_percent_stores_l1hit = {
.header = HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2),
.name = "percent_stores_l1hit",
@@ -1602,7 +1665,7 @@ static struct c2c_dimension dim_node = {
};

static struct c2c_dimension dim_mean_rmt = {
- .header = HEADER_SPAN("---------- cycles ----------", "rmt hitm", 2),
+ .header = HEADER_SPAN("--------------- cycles ---------------", "rmt hitm", 3),
.name = "mean_rmt",
.cmp = empty_cmp,
.entry = mean_rmt_entry,
@@ -1625,6 +1688,14 @@ static struct c2c_dimension dim_mean_load = {
.width = 8,
};

+static struct c2c_dimension dim_mean_peer = {
+ .header = HEADER_SPAN_LOW("peer"),
+ .name = "mean_peer",
+ .cmp = empty_cmp,
+ .entry = mean_peer_entry,
+ .width = 8,
+};
+
static struct c2c_dimension dim_cpucnt = {
.header = HEADER_BOTH("cpu", "cnt"),
.name = "cpucnt",
@@ -1672,8 +1743,10 @@ static struct c2c_dimension *dimensions[] = {
&dim_tot_hitm,
&dim_lcl_hitm,
&dim_rmt_hitm,
+ &dim_ld_peer,
&dim_cl_lcl_hitm,
&dim_cl_rmt_hitm,
+ &dim_cl_ld_peer,
&dim_tot_stores,
&dim_stores_l1hit,
&dim_stores_l1miss,
@@ -1691,6 +1764,7 @@ static struct c2c_dimension *dimensions[] = {
&dim_percent_hitm,
&dim_percent_rmt_hitm,
&dim_percent_lcl_hitm,
+ &dim_percent_ld_peer,
&dim_percent_stores_l1hit,
&dim_percent_stores_l1miss,
&dim_percent_stores_na,
@@ -1704,6 +1778,7 @@ static struct c2c_dimension *dimensions[] = {
&dim_mean_rmt,
&dim_mean_lcl,
&dim_mean_load,
+ &dim_mean_peer,
&dim_cpucnt,
&dim_srcline,
&dim_dcacheline_idx,
@@ -2202,6 +2277,7 @@ static void print_c2c__display_stats(FILE *out)
fprintf(out, " Load LLC Misses : %10d\n", llc_misses);
fprintf(out, " Load access blocked by data : %10d\n", stats->blk_data);
fprintf(out, " Load access blocked by address : %10d\n", stats->blk_addr);
+ fprintf(out, " Load HIT Peer : %10d\n", stats->ld_peer);
fprintf(out, " LLC Misses to Local DRAM : %10.1f%%\n", ((double)stats->lcl_dram/(double)llc_misses) * 100.);
fprintf(out, " LLC Misses to Remote DRAM : %10.1f%%\n", ((double)stats->rmt_dram/(double)llc_misses) * 100.);
fprintf(out, " LLC Misses to Remote cache (HIT) : %10.1f%%\n", ((double)stats->rmt_hit /(double)llc_misses) * 100.);
@@ -2229,6 +2305,7 @@ static void print_shared_cacheline_info(FILE *out)
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, " Load HITs on peer cache lines : %10d\n", stats->ld_peer);
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, " Blocked Access on shared lines : %10d\n", stats->blk_data + stats->blk_addr);
@@ -2257,10 +2334,10 @@ static void print_cacheline(struct c2c_hists *c2c_hists,
fprintf(out, "\n");
}

- fprintf(out, " ----------------------------------------------------------------------\n");
+ fprintf(out, " -------------------------------------------------------------------------------\n");
__hist_entry__snprintf(he_cl, &hpp, hpp_list);
fprintf(out, "%s\n", bf);
- fprintf(out, " ----------------------------------------------------------------------\n");
+ fprintf(out, " -------------------------------------------------------------------------------\n");

hists__fprintf(&c2c_hists->hists, false, 0, 0, 0, out, false);
}
@@ -2275,6 +2352,7 @@ static void print_pareto(FILE *out)
cl_output = "cl_num,"
"cl_rmt_hitm,"
"cl_lcl_hitm,"
+ "cl_ld_peer,"
"cl_stores_l1hit,"
"cl_stores_l1miss,"
"cl_stores_na,"
@@ -2727,6 +2805,7 @@ static int build_cl_output(char *cl_sort, bool no_source)
c2c.use_stdio ? "cl_num_empty," : "",
"percent_rmt_hitm,"
"percent_lcl_hitm,"
+ "percent_ld_peer,"
"percent_stores_l1hit,"
"percent_stores_l1miss,"
"percent_stores_na,"
@@ -2737,6 +2816,7 @@ static int build_cl_output(char *cl_sort, bool no_source)
"mean_rmt,"
"mean_lcl,"
"mean_load,"
+ "mean_peer,"
"tot_recs,"
"cpucnt,",
add_sym ? "symbol," : "",
@@ -2913,6 +2993,7 @@ static int perf_c2c__report(int argc, const char **argv)
"dcacheline_count,"
"percent_hitm,"
"tot_hitm,lcl_hitm,rmt_hitm,"
+ "ld_peer,"
"tot_recs,"
"tot_loads,"
"tot_stores,"
--
2.25.1
\
 
 \ /
  Last update: 2022-05-18 08:02    [W:2.261 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site