aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-11-19 16:30:56 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-11-19 16:30:56 -0300
commit7b59a82493b49b715224bfe3b35fae52e48e5fa1 (patch)
tree19ea4fc7681d4806d13b3f0c5b63620abbd91698 /tools/perf/util/sort.c
parentperf map: Pass a dso_id to map__new() (diff)
downloadlinux-dev-7b59a82493b49b715224bfe3b35fae52e48e5fa1.tar.xz
linux-dev-7b59a82493b49b715224bfe3b35fae52e48e5fa1.zip
perf map: Move comparision of map's dso_id to a separate function
We'll use it when doing DSO lookups using dso_ids. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-u2nr1oq03o0i29w2ay9jx03s@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r--tools/perf/util/sort.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index bc589438cd12..f1481002fafb 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1194,6 +1194,7 @@ sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right)
{
u64 l, r;
struct map *l_map, *r_map;
+ int rc;
if (!left->mem_info) return -1;
if (!right->mem_info) return 1;
@@ -1212,18 +1213,9 @@ sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right)
if (!l_map) return -1;
if (!r_map) return 1;
- if (l_map->dso_id.maj > r_map->dso_id.maj) return -1;
- if (l_map->dso_id.maj < r_map->dso_id.maj) return 1;
-
- if (l_map->dso_id.min > r_map->dso_id.min) return -1;
- if (l_map->dso_id.min < r_map->dso_id.min) return 1;
-
- if (l_map->dso_id.ino > r_map->dso_id.ino) return -1;
- if (l_map->dso_id.ino < r_map->dso_id.ino) return 1;
-
- if (l_map->dso_id.ino_generation > r_map->dso_id.ino_generation) return -1;
- if (l_map->dso_id.ino_generation < r_map->dso_id.ino_generation) return 1;
-
+ rc = dso_id__cmp(&l_map->dso_id, &r_map->dso_id);
+ if (rc)
+ return rc;
/*
* Addresses with no major/minor numbers are assumed to be
* anonymous in userspace. Sort those on pid then address.