struct c2c_hists {
struct hists hists;
struct perf_hpp_list list;
+ struct c2c_stats stats;
};
struct c2c_hist_entry {
struct c2c_hists *hists;
+ struct c2c_stats stats;
/*
* must be at the end,
* because of its callchain dynamic entry
static int c2c_hists__init(struct c2c_hists *hists,
const char *sort);
-static struct hists*
-he__get_hists(struct hist_entry *he,
- const char *sort)
+static struct c2c_hists*
+he__get_c2c_hists(struct hist_entry *he,
+ const char *sort)
{
struct c2c_hist_entry *c2c_he;
struct c2c_hists *hists;
c2c_he = container_of(he, struct c2c_hist_entry, he);
if (c2c_he->hists)
- return &c2c_he->hists->hists;
+ return c2c_he->hists;
hists = c2c_he->hists = zalloc(sizeof(*hists));
if (!hists)
return NULL;
}
- return &hists->hists;
+ return hists;
}
static int process_sample_event(struct perf_tool *tool __maybe_unused,
struct perf_evsel *evsel __maybe_unused,
struct machine *machine)
{
- struct hists *hists = &c2c.hists.hists;
+ struct c2c_hists *c2c_hists = &c2c.hists;
+ struct c2c_hist_entry *c2c_he;
+ struct c2c_stats stats = { .nr_entries = 0, };
struct hist_entry *he;
struct addr_location al;
struct mem_info *mi, *mi_dup;
if (!mi_dup)
goto free_mi;
- he = hists__add_entry_ops(hists, &c2c_entry_ops,
+ c2c_decode_stats(&stats, mi);
+
+ he = hists__add_entry_ops(&c2c_hists->hists, &c2c_entry_ops,
&al, NULL, NULL, mi,
sample, true);
if (he == NULL)
goto free_mi_dup;
- hists__inc_nr_samples(hists, he->filtered);
+ c2c_he = container_of(he, struct c2c_hist_entry, he);
+ c2c_add_stats(&c2c_he->stats, &stats);
+ c2c_add_stats(&c2c_hists->stats, &stats);
+
+ hists__inc_nr_samples(&c2c_hists->hists, he->filtered);
ret = hist_entry__append_callchain(he, sample);
if (!ret) {
if (!mi_dup)
goto free_mi;
- hists = he__get_hists(he, "offset");
- if (!hists)
+ c2c_hists = he__get_c2c_hists(he, "offset");
+ if (!c2c_hists)
goto free_mi_dup;
- he = hists__add_entry_ops(hists, &c2c_entry_ops,
+ he = hists__add_entry_ops(&c2c_hists->hists, &c2c_entry_ops,
&al, NULL, NULL, mi,
sample, true);
if (he == NULL)
goto free_mi_dup;
- hists__inc_nr_samples(hists, he->filtered);
+ c2c_he = container_of(he, struct c2c_hist_entry, he);
+ c2c_add_stats(&c2c_he->stats, &stats);
+ c2c_add_stats(&c2c_hists->stats, &stats);
+
+ hists__inc_nr_samples(&c2c_hists->hists, he->filtered);
ret = hist_entry__append_callchain(he, sample);
}