From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756713AbcAIQkB (ORCPT ); Sat, 9 Jan 2016 11:40:01 -0500 Received: from terminus.zytor.com ([198.137.202.10]:42302 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756214AbcAIQj7 (ORCPT ); Sat, 9 Jan 2016 11:39:59 -0500 Date: Sat, 9 Jan 2016 08:39:44 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: mingo@kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org, dsahern@gmail.com, noelgrandin@gmail.com, acme@redhat.com, tglx@linutronix.de, adrian.hunter@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, tglx@linutronix.de, adrian.hunter@intel.com, acme@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, dsahern@gmail.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, noelgrandin@gmail.com In-Reply-To: <1452158050-28061-14-git-send-email-jolsa@kernel.org> References: <1452158050-28061-14-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists: Export a couple of hist functions Git-Commit-ID: fc284be9d88528dd2a28d5471e40a6acde6c3036 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: fc284be9d88528dd2a28d5471e40a6acde6c3036 Gitweb: http://git.kernel.org/tip/fc284be9d88528dd2a28d5471e40a6acde6c3036 Author: Namhyung Kim AuthorDate: Thu, 7 Jan 2016 10:14:10 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 8 Jan 2016 12:59:48 -0300 perf hists: Export a couple of hist functions These are necessary for multi threaded sample processing: - hists__get__get_rotate_entries_in() - hists__collapse_insert_entry() - __hists__init() Signed-off-by: Namhyung Kim Cc: Adrian Hunter Cc: David Ahern Cc: Noel Grandin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1452158050-28061-14-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 19 ++++++++++++------- tools/perf/util/hist.h | 5 +++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 888776b..c226303 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1007,9 +1007,8 @@ void hist_entry__delete(struct hist_entry *he) * collapse the histogram */ -static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, - struct rb_root *root, - struct hist_entry *he) +bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, + struct rb_root *root, struct hist_entry *he) { struct rb_node **p = &root->rb_node; struct rb_node *parent = NULL; @@ -1049,7 +1048,7 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, return true; } -static struct rb_root *hists__get_rotate_entries_in(struct hists *hists) +struct rb_root *hists__get_rotate_entries_in(struct hists *hists) { struct rb_root *root; @@ -1584,10 +1583,8 @@ int perf_hist_config(const char *var, const char *value) return 0; } -static int hists_evsel__init(struct perf_evsel *evsel) +int __hists__init(struct hists *hists) { - struct hists *hists = evsel__hists(evsel); - memset(hists, 0, sizeof(*hists)); hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; hists->entries_in = &hists->entries_in_array[0]; @@ -1627,6 +1624,14 @@ static void hists_evsel__exit(struct perf_evsel *evsel) hists__delete_all_entries(hists); } +static int hists_evsel__init(struct perf_evsel *evsel) +{ + struct hists *hists = evsel__hists(evsel); + + __hists__init(hists); + return 0; +} + /* * XXX We probably need a hists_evsel__exit() to free the hist_entries * stored in the rbtree... diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index cb8f373..d4ec482 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -185,6 +185,11 @@ static inline struct hists *evsel__hists(struct perf_evsel *evsel) } int hists__init(void); +int __hists__init(struct hists *hists); + +struct rb_root *hists__get_rotate_entries_in(struct hists *hists); +bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, + struct rb_root *root, struct hist_entry *he); struct perf_hpp { char *buf;