From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965121AbcIVPiP (ORCPT ); Thu, 22 Sep 2016 11:38:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46946 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965066AbcIVPiK (ORCPT ); Thu, 22 Sep 2016 11:38:10 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Don Zickus , Joe Mario , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , Andi Kleen Subject: [PATCH 18/57] perf c2c report: Decode c2c_stats for hist entries Date: Thu, 22 Sep 2016 17:36:46 +0200 Message-Id: <1474558645-19956-19-git-send-email-jolsa@kernel.org> In-Reply-To: <1474558645-19956-1-git-send-email-jolsa@kernel.org> References: <1474558645-19956-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 22 Sep 2016 15:38:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Decoding and storing c2c_stats for each hist entry. Changing related function to work with c2c_* objects. Link: http://lkml.kernel.org/n/tip-obz2fu3801wuayz4rntegb1d@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-c2c.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index cd0406ab8b5d..7bf6248dbd75 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -14,10 +14,12 @@ 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 @@ -64,9 +66,9 @@ static struct hist_entry_ops c2c_entry_ops = { 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; @@ -74,7 +76,7 @@ he__get_hists(struct hist_entry *he, 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) @@ -84,7 +86,7 @@ he__get_hists(struct hist_entry *he, if (ret) free(hists); - return &hists->hists; + return hists; } static int process_sample_event(struct perf_tool *tool __maybe_unused, @@ -93,7 +95,9 @@ 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 = { 0 }; struct hist_entry *he; struct addr_location al; struct mem_info *mi, *mi_dup; @@ -113,13 +117,19 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, 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) { @@ -129,17 +139,21 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, 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); } -- 2.7.4