All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] perf tools: callchain: Warn only once in empty node detection
@ 2009-08-08  2:26 Frederic Weisbecker
  2009-08-08  2:26 ` [PATCH 1/3] perfcounter: Initialize tracepoint record before any use Frederic Weisbecker
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: Frederic Weisbecker @ 2009-08-08  2:26 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Mike Galbraith

When we fill a new node that is found to be empty (sign of a bug),
we print a message each time that happens. Sometimes we reach thousands
of lines printed.

Just warn only once in that case (and use stderr instead of stdout).

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
---
 tools/perf/util/callchain.c |    3 ++-
 tools/perf/util/util.h      |    3 +++
 tools/perf/util/wrapper.c   |   16 ++++++++++++++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 98c5627..ce0c6d4 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <errno.h>
+#include "util.h"
 
 #include "callchain.h"
 
@@ -203,7 +204,7 @@ fill_node(struct callchain_node *node, struct ip_callchain *chain,
 	}
 	node->val_nr = chain->nr - start;
 	if (!node->val_nr)
-		printf("Warning: empty node in callchain tree\n");
+		fprintf_once(stderr, "Warning: empty node in callchain tree\n");
 }
 
 static void
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 68fe157..386ea40 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -148,6 +148,9 @@ static inline const char *skip_prefix(const char *str, const char *prefix)
 	return strncmp(str, prefix, len) ? NULL : str + len;
 }
 
+extern int fprintf_once(FILE *fp, const char *fmt, ...)
+	__attribute__((format (printf, 2, 3)));
+
 #if defined(NO_MMAP) || defined(USE_WIN32_MMAP)
 
 #ifndef PROT_READ
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c
index 4574ac2..026c87c 100644
--- a/tools/perf/util/wrapper.c
+++ b/tools/perf/util/wrapper.c
@@ -205,3 +205,19 @@ int xmkstemp(char *template)
 		die("Unable to create temporary file: %s", strerror(errno));
 	return fd;
 }
+
+int fprintf_once(FILE *fp, const char *fmt, ...)
+{
+	va_list args;
+	int ret;
+	static int once;
+
+	if (once++)
+		return 1;
+
+	va_start(args, fmt);
+	ret = vfprintf(fp, fmt, args);
+	va_end(args);
+
+	return ret;
+}
-- 
1.6.2.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-08-10 18:02 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-08  2:26 [PATCH 1/4] perf tools: callchain: Warn only once in empty node detection Frederic Weisbecker
2009-08-08  2:26 ` [PATCH 1/3] perfcounter: Initialize tracepoint record before any use Frederic Weisbecker
2009-08-08  2:30   ` Frederic Weisbecker
2009-08-10  9:27   ` [PATCH 4/3] perf_counter: Correct PERF_SAMPLE_RAW output Peter Zijlstra
2009-08-10  9:36     ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
2009-08-10  9:48     ` [PATCH 4/3] " Frederic Weisbecker
2009-08-10 12:57     ` Frederic Weisbecker
2009-08-10 13:06       ` Peter Zijlstra
2009-08-10 14:11         ` [PATCH 6/3] perfcounter: Substract the buffer size field from the event record size Frederic Weisbecker
2009-08-10 14:13           ` Peter Zijlstra
2009-08-10 14:21           ` [tip:perfcounters/urgent] perf_counter: Subtract " tip-bot for Frederic Weisbecker
2009-08-10  9:27   ` [PATCH 5/3] perf_counter: Require CAP_SYS_ADMIN for raw tracepoint data Peter Zijlstra
2009-08-10  9:36     ` [tip:perfcounters/urgent] " tip-bot for Peter Zijlstra
2009-08-08  2:26 ` [PATCH 2/4] perf tools: callchain: Ignore empty callchains Frederic Weisbecker
2009-08-08  2:26 ` [PATCH 2/3] perfcounter: Generalize the tracepoint sampling to generic sampling Frederic Weisbecker
2009-08-08 11:52   ` [tip:perfcounters/core] perf_counter: Fix tracepoint sampling to be part of " tip-bot for Frederic Weisbecker
2009-08-09 11:10   ` tip-bot for Frederic Weisbecker
2009-08-08  2:26 ` [PATCH 3/4] perf tools: callchain: Default display callchain from report if recorded with -g Frederic Weisbecker
2009-08-08  2:26 ` [PATCH 3/3] perfcounter: Align ftrace events raw samples to 8 bytes Frederic Weisbecker
2009-08-08 11:52   ` [tip:perfcounters/core] perf_counter: Fix ftrace events raw samples to be aligned " tip-bot for Frederic Weisbecker
2009-08-10  7:13   ` [PATCH 3/3] perfcounter: Align ftrace events raw samples " Peter Zijlstra
2009-08-10  7:32     ` Frederic Weisbecker
2009-08-10 14:38     ` [PATCH 7/3] perfcounter: Zeroe dead bytes from ftrace raw samples size alignment Frederic Weisbecker
2009-08-10 18:01       ` [tip:perfcounters/urgent] perf_counter: Zero " tip-bot for Frederic Weisbecker
2009-08-08  2:26 ` [PATCH 4/4] perf tools: callchain: Display amount of ignored chains in fractal mode Frederic Weisbecker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.