Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1326746
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
| Newsgroups | linux.kernel |
| Subject | [tip:perf/core] perf hists: Add 'equal' method to perf_hpp_fmt struct |
| Date | Thu, 04 Feb 2016 13:40:04 +0100 |
| Message-ID | <qYrmA-da-59@gated-at.bofh.it> (permalink) |
| References | <qSes1-78G-11@gated-at.bofh.it> |
| Reply-To | mingo@kernel.org, dsahern@gmail.com, hpa@zytor.com, jolsa@kernel.org, acme@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, namhyung@kernel.org |
| Git-Commit-ID | 97358084b91e94e5f8fcf0379f0430c0ea16bd3b |
| X-Mailer | tip-git-log-daemon |
| Robot-ID | <tip-bot.git.kernel.org> |
| Robot-Unsubscribe | Contact <mailto:hpa@kernel.org> 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 | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 149 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | namhyung@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, dsahern@gmail.com, mingo@kernel.org |
| X-Original-Date | Thu, 4 Feb 2016 04:34:53 -0800 |
| X-Original-Message-ID | <tip-97358084b91e94e5f8fcf0379f0430c0ea16bd3b@git.kernel.org> |
| X-Original-References | <1453109064-1026-6-git-send-email-jolsa@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1326746 |
Show key headers only | View raw
Commit-ID: 97358084b91e94e5f8fcf0379f0430c0ea16bd3b
Gitweb: http://git.kernel.org/tip/97358084b91e94e5f8fcf0379f0430c0ea16bd3b
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 18 Jan 2016 10:24:03 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 3 Feb 2016 11:13:12 -0300
perf hists: Add 'equal' method to perf_hpp_fmt struct
To easily compare format entries and make it available for all kinds of
format entries.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1453109064-1026-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/hist.c | 9 +++++++--
tools/perf/util/hist.h | 2 +-
tools/perf/util/sort.c | 39 ++++++++++++++++++++-------------------
3 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 5a11bf0..71c8bb7 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -524,6 +524,11 @@ void perf_hpp__cancel_cumulate(void)
perf_hpp__format[PERF_HPP__OVERHEAD].name = "Overhead";
}
+static bool fmt_equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
+{
+ return a->equal && a->equal(a, b);
+}
+
void perf_hpp__setup_output_field(void)
{
struct perf_hpp_fmt *fmt;
@@ -542,7 +547,7 @@ void perf_hpp__setup_output_field(void)
struct perf_hpp_fmt *pos;
perf_hpp__for_each_format(pos) {
- if (perf_hpp__same_sort_entry(pos, fmt))
+ if (fmt_equal(fmt, pos))
goto next;
}
}
@@ -571,7 +576,7 @@ void perf_hpp__append_sort_keys(void)
struct perf_hpp_fmt *pos;
perf_hpp__for_each_sort_list(pos) {
- if (perf_hpp__same_sort_entry(pos, fmt))
+ if (fmt_equal(fmt, pos))
goto next;
}
}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8a0cbde..9a240d7 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -215,6 +215,7 @@ struct perf_hpp_fmt {
struct hist_entry *a, struct hist_entry *b);
int64_t (*sort)(struct perf_hpp_fmt *fmt,
struct hist_entry *a, struct hist_entry *b);
+ bool (*equal)(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
struct list_head list;
struct list_head sort_list;
@@ -268,7 +269,6 @@ void perf_hpp__reset_output_field(void);
void perf_hpp__append_sort_keys(void);
bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
-bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
bool perf_hpp__is_dynamic_entry(struct perf_hpp_fmt *format);
bool perf_hpp__defined_dynamic_entry(struct perf_hpp_fmt *fmt, struct hists *hists);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 898e4b0..170f7f7 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1441,20 +1441,6 @@ struct hpp_sort_entry {
struct sort_entry *se;
};
-bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
-{
- struct hpp_sort_entry *hse_a;
- struct hpp_sort_entry *hse_b;
-
- if (!perf_hpp__is_sort_entry(a) || !perf_hpp__is_sort_entry(b))
- return false;
-
- hse_a = container_of(a, struct hpp_sort_entry, hpp);
- hse_b = container_of(b, struct hpp_sort_entry, hpp);
-
- return hse_a->se == hse_b->se;
-}
-
void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists)
{
struct hpp_sort_entry *hse;
@@ -1540,6 +1526,25 @@ static int64_t __sort__hpp_sort(struct perf_hpp_fmt *fmt,
return sort_fn(a, b);
}
+bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format)
+{
+ return format->header == __sort__hpp_header;
+}
+
+static bool __sort__hpp_equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
+{
+ struct hpp_sort_entry *hse_a;
+ struct hpp_sort_entry *hse_b;
+
+ if (!perf_hpp__is_sort_entry(a) || !perf_hpp__is_sort_entry(b))
+ return false;
+
+ hse_a = container_of(a, struct hpp_sort_entry, hpp);
+ hse_b = container_of(b, struct hpp_sort_entry, hpp);
+
+ return hse_a->se == hse_b->se;
+}
+
static struct hpp_sort_entry *
__sort_dimension__alloc_hpp(struct sort_dimension *sd)
{
@@ -1561,6 +1566,7 @@ __sort_dimension__alloc_hpp(struct sort_dimension *sd)
hse->hpp.cmp = __sort__hpp_cmp;
hse->hpp.collapse = __sort__hpp_collapse;
hse->hpp.sort = __sort__hpp_sort;
+ hse->hpp.equal = __sort__hpp_equal;
INIT_LIST_HEAD(&hse->hpp.list);
INIT_LIST_HEAD(&hse->hpp.sort_list);
@@ -1571,11 +1577,6 @@ __sort_dimension__alloc_hpp(struct sort_dimension *sd)
return hse;
}
-bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format)
-{
- return format->header == __sort__hpp_header;
-}
-
static int __sort_dimension__add_hpp_sort(struct sort_dimension *sd)
{
struct hpp_sort_entry *hse = __sort_dimension__alloc_hpp(sd);
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[tip:perf/core] perf hists: Add 'equal' method to perf_hpp_fmt struct tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-02-04 13:40 +0100
csiph-web