Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474568

[PATCH 13/19] perf test vmlinux: Avoid printing headers for empty lists

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 13/19] perf test vmlinux: Avoid printing headers for empty lists
Date 2016-09-01 19:00 +0200
Message-ID <scDvj-4op-1@gated-at.bofh.it> (permalink)
References <scDlD-4lf-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Arnaldo Carvalho de Melo <acme@redhat.com>

Before:

  # perf test -F -v 1
   1: vmlinux symtab matches kallsyms:
  --- start ---
<SNIP>
  WARN: Maps only in vmlinux:
   ffffffffb7d7d000-ffffffffb7eeaac8 117d000 [kernel].init.text
   ffffffffb7eeaac8-ffffffffc03ad000 12eaac8 [kernel].exit.text
  WARN: Maps in vmlinux with a different name in kallsyms:
  WARN: Maps only in kallsyms:
  ---- end ----
  vmlinux symtab matches kallsyms: Ok
  #

The two last WARN lines are now suppressed, since there are no such
cases detected.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-9ww8uvzl682ykaw8ht1tozlr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/vmlinux-kallsyms.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c
index 6bd5bf980de2..450f69960931 100644
--- a/tools/perf/tests/vmlinux-kallsyms.c
+++ b/tools/perf/tests/vmlinux-kallsyms.c
@@ -28,6 +28,7 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused)
 	enum map_type type = MAP__FUNCTION;
 	struct maps *maps = &vmlinux.kmaps.maps[type];
 	u64 mem_start, mem_end;
+	bool header_printed;
 
 	/*
 	 * Step 1:
@@ -178,7 +179,7 @@ next_pair:
 	if (!verbose)
 		goto out;
 
-	pr_info("WARN: Maps only in vmlinux:\n");
+	header_printed = false;
 
 	for (map = maps__first(maps); map; map = map__next(map)) {
 		struct map *
@@ -192,13 +193,18 @@ next_pair:
 						(map->dso->kernel ?
 							map->dso->short_name :
 							map->dso->name));
-		if (pair)
+		if (pair) {
 			pair->priv = 1;
-		else
+		} else {
+			if (!header_printed) {
+				pr_info("WARN: Maps only in vmlinux:\n");
+				header_printed = true;
+			}
 			map__fprintf(map, stderr);
+		}
 	}
 
-	pr_info("WARN: Maps in vmlinux with a different name in kallsyms:\n");
+	header_printed = false;
 
 	for (map = maps__first(maps); map; map = map__next(map)) {
 		struct map *pair;
@@ -211,7 +217,11 @@ next_pair:
 			continue;
 
 		if (pair->start == mem_start) {
-			pair->priv = 1;
+			if (!header_printed) {
+				pr_info("WARN: Maps in vmlinux with a different name in kallsyms:\n");
+				header_printed = true;
+			}
+
 			pr_info("WARN: %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as",
 				map->start, map->end, map->pgoff, map->dso->name);
 			if (mem_end != pair->end)
@@ -222,13 +232,18 @@ next_pair:
 		}
 	}
 
-	pr_info("WARN: Maps only in kallsyms:\n");
+	header_printed = false;
 
 	maps = &kallsyms.kmaps.maps[type];
 
 	for (map = maps__first(maps); map; map = map__next(map)) {
-		if (!map->priv)
+		if (!map->priv) {
+			if (!header_printed) {
+				pr_info("WARN: Maps only in kallsyms:\n");
+				header_printed = true;
+			}
 			map__fprintf(map, stderr);
+		}
 	}
 out:
 	machine__exit(&kallsyms);
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 18:50 +0200
  [PATCH 16/19] perf symbols: Fixup symbol sizes before picking best ones Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 18:50 +0200
  [PATCH 08/19] perf probe: Show trace event definition Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 18:50 +0200
  [PATCH 12/19] perf test vmlinux: Clarify which -v lines are errors or warning Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 18:50 +0200
  [PATCH 13/19] perf test vmlinux: Avoid printing headers for empty lists Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 19:00 +0200
  [PATCH 01/19] perf probe: Remove unused tracing_dir variable Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-01 19:00 +0200
  Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-09-05 15:20 +0200

csiph-web