perf kvm: Limit repetitive guestmount message to once per directory
authorDavid Ahern <dsahern@gmail.com>
Fri, 20 Jul 2012 23:25:51 +0000 (17:25 -0600)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Jul 2012 14:31:03 +0000 (11:31 -0300)
After 7ed97ad use of the guestmount option without a subdir for *each*
VM generates an error message for each sample related to that VM. Once
per VM is enough.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1342826756-64663-7-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c

index 16d783d322b609094fb0b4a9405afc960480a7e6..cc33486ad9e25b80e8486a4c60fce41d03a60b15 100644 (file)
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include "map.h"
 #include "thread.h"
+#include "strlist.h"
 
 const char *map_type__name[MAP__NR_TYPES] = {
        [MAP__FUNCTION] = "Functions",
@@ -695,7 +696,15 @@ struct machine *machines__findnew(struct rb_root *self, pid_t pid)
            (symbol_conf.guestmount)) {
                sprintf(path, "%s/%d", symbol_conf.guestmount, pid);
                if (access(path, R_OK)) {
-                       pr_err("Can't access file %s\n", path);
+                       static struct strlist *seen;
+
+                       if (!seen)
+                               seen = strlist__new(true, NULL);
+
+                       if (!strlist__has_entry(seen, path)) {
+                               pr_err("Can't access file %s\n", path);
+                               strlist__add(seen, path);
+                       }
                        machine = NULL;
                        goto out;
                }