linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@kernel.org, acme@redhat.com, namhyung@kernel.org,
	tglx@linutronix.de, eranian@google.com, andi@firstfloor.org,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	dsahern@gmail.com, wangnan0@huawei.com, hpa@zytor.com,
	mingo@kernel.org
Subject: [tip:perf/core] perf tools: Add more sort entry check functions
Date: Fri, 11 Mar 2016 00:48:27 -0800	[thread overview]
Message-ID: <tip-4945cf2aa1ed61994c158f22f26ea6101059a8d4@git.kernel.org> (raw)
In-Reply-To: <1457531222-18130-3-git-send-email-namhyung@kernel.org>

Commit-ID:  4945cf2aa1ed61994c158f22f26ea6101059a8d4
Gitweb:     http://git.kernel.org/tip/4945cf2aa1ed61994c158f22f26ea6101059a8d4
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 9 Mar 2016 22:46:57 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 10 Mar 2016 16:45:44 -0300

perf tools: Add more sort entry check functions

Those functions are for checkinf if a given perf_hpp_fmt is a
filter-related sort entry.  With hierarchy mode, it needs to check
filters on the hist entries with its own hpp format list.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1457531222-18130-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.h |  4 ++++
 tools/perf/util/sort.c | 50 +++++++++++++++++++-------------------------------
 2 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 2cb017f..6870a1b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -318,6 +318,10 @@ bool perf_hpp__defined_dynamic_entry(struct perf_hpp_fmt *fmt, struct hists *his
 bool perf_hpp__is_trace_entry(struct perf_hpp_fmt *fmt);
 bool perf_hpp__is_srcline_entry(struct perf_hpp_fmt *fmt);
 bool perf_hpp__is_srcfile_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_thread_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_comm_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_dso_entry(struct perf_hpp_fmt *fmt);
+bool perf_hpp__is_sym_entry(struct perf_hpp_fmt *fmt);
 
 struct perf_hpp_fmt *perf_hpp_fmt__dup(struct perf_hpp_fmt *fmt);
 
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 8a49a07..61c7402 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1488,38 +1488,26 @@ bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format)
 	return format->header == __sort__hpp_header;
 }
 
-bool perf_hpp__is_trace_entry(struct perf_hpp_fmt *fmt)
-{
-	struct hpp_sort_entry *hse;
+#define MK_SORT_ENTRY_CHK(key)					\
+bool perf_hpp__is_ ## key ## _entry(struct perf_hpp_fmt *fmt)	\
+{								\
+	struct hpp_sort_entry *hse;				\
+								\
+	if (!perf_hpp__is_sort_entry(fmt))			\
+		return false;					\
+								\
+	hse = container_of(fmt, struct hpp_sort_entry, hpp);	\
+	return hse->se == &sort_ ## key ;			\
+}
+
+MK_SORT_ENTRY_CHK(trace)
+MK_SORT_ENTRY_CHK(srcline)
+MK_SORT_ENTRY_CHK(srcfile)
+MK_SORT_ENTRY_CHK(thread)
+MK_SORT_ENTRY_CHK(comm)
+MK_SORT_ENTRY_CHK(dso)
+MK_SORT_ENTRY_CHK(sym)
 
-	if (!perf_hpp__is_sort_entry(fmt))
-		return false;
-
-	hse = container_of(fmt, struct hpp_sort_entry, hpp);
-	return hse->se == &sort_trace;
-}
-
-bool perf_hpp__is_srcline_entry(struct perf_hpp_fmt *fmt)
-{
-	struct hpp_sort_entry *hse;
-
-	if (!perf_hpp__is_sort_entry(fmt))
-		return false;
-
-	hse = container_of(fmt, struct hpp_sort_entry, hpp);
-	return hse->se == &sort_srcline;
-}
-
-bool perf_hpp__is_srcfile_entry(struct perf_hpp_fmt *fmt)
-{
-	struct hpp_sort_entry *hse;
-
-	if (!perf_hpp__is_sort_entry(fmt))
-		return false;
-
-	hse = container_of(fmt, struct hpp_sort_entry, hpp);
-	return hse->se == &sort_srcfile;
-}
 
 static bool __sort__hpp_equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
 {

  reply	other threads:[~2016-03-11  8:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 13:46 [PATCHSET 0/7] perf tools: Fix and cleanups for hierarchy mode (v2) Namhyung Kim
2016-03-09 13:46 ` [PATCH v2 1/7] perf tools: Fix hist_entry__filter() for hierarchy Namhyung Kim
2016-03-11  8:48   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 13:46 ` [PATCH v2 2/7] perf tools: Add more sort entry check functions Namhyung Kim
2016-03-11  8:48   ` tip-bot for Namhyung Kim [this message]
2016-03-09 13:46 ` [PATCH v2 3/7] perf tools: Fix command line filters in hierarchy mode Namhyung Kim
2016-03-11  8:48   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 13:46 ` [PATCH v2 4/7] perf tools: Remove hist_entry->fmt field Namhyung Kim
2016-03-11  8:49   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 13:47 ` [PATCH v2 5/7] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Namhyung Kim
2016-03-11  8:49   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 13:47 ` [PATCH v2 6/7] perf tools: Remove nr_sort_keys field Namhyung Kim
2016-03-11  8:50   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-09 13:47 ` [PATCH v2 7/7] perf tools: Recalc total periods using top-level entries in hierarchy Namhyung Kim
2016-03-11  8:50   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-10 10:33 ` [PATCHSET 0/7] perf tools: Fix and cleanups for hierarchy mode (v2) Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-4945cf2aa1ed61994c158f22f26ea6101059a8d4@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).