From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068Ab2GXJHE (ORCPT ); Tue, 24 Jul 2012 05:07:04 -0400 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:55515 "EHLO LGEMRELSE6Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752916Ab2GXJHA (ORCPT ); Tue, 24 Jul 2012 05:07:00 -0400 X-AuditID: 9c930179-b7bdcae000003d91-ff-500e65b1193e From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , LKML , Stephane Eranian , Jiri Olsa , Ulrich Drepper , Andi Kleen , Namhyung Kim Subject: [PATCH 04/12] perf hist: Maintain total periods of group members in the leader Date: Tue, 24 Jul 2012 18:01:25 +0900 Message-Id: <1343120493-23059-5-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343120493-23059-1-git-send-email-namhyung@kernel.org> References: <1343120493-23059-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim Like group_stats in hist_entry, total periods information also need to be known to the leader. Cc: Stephane Eranian Cc: Jiri Olsa Signed-off-by: Namhyung Kim --- tools/perf/util/hist.c | 25 +++++++++++++++++++++++++ tools/perf/util/hist.h | 1 + 2 files changed, 26 insertions(+) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a8f4c56261a0..5ae71429ba53 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -427,6 +427,28 @@ static void hist_entry__add_group_stat(struct perf_evsel *evsel, hist_entry__add_stat(&iter->stat, &he->stat); } +static void hists__add_group_stat(struct hists *hists) +{ + struct perf_evsel *evsel = hists_2_evsel(hists); + struct perf_evsel *leader = evsel->leader; + struct hists *leader_hists; + + if (perf_evsel__is_group_leader(evsel)) + return; + + leader_hists = &leader->hists; + + if (!leader_hists->group_stats) { + leader_hists->group_stats = calloc(leader->nr_children, + sizeof(struct events_stats)); + if (!leader_hists->group_stats) + return; + } + + memcpy(&leader_hists->group_stats[evsel->group_idx], + &hists->stats, sizeof(struct events_stats)); +} + /* * collapse the histogram */ @@ -546,6 +568,9 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded) hists__apply_filters(hists, n); } } + + if (symbol_conf.report_group) + hists__add_group_stat(hists); } void hists__collapse_resort(struct hists *hists) diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 8594459594d9..5f81ee723c77 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -66,6 +66,7 @@ struct hists { const char *symbol_filter_str; pthread_mutex_t lock; struct events_stats stats; + struct events_stats *group_stats; u64 event_stream; u16 col_len[HISTC_NR_COLS]; }; -- 1.7.10.4