perf evlist: Add fprintf method
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Sep 2012 17:54:11 +0000 (14:54 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Sep 2012 17:54:11 +0000 (14:54 -0300)
For debugging, etc.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-fjimge1ovgh976qlt8dtmlp0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evlist.c
tools/perf/util/evlist.h

index 4774ac1e3d5f3934f78feaa6f70ad02801b1837d..892353729c7a7b8e83b632556699c769977a60ae 100644 (file)
@@ -889,3 +889,16 @@ int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *even
        struct perf_evsel *evsel = perf_evlist__first(evlist);
        return perf_evsel__parse_sample(evsel, event, sample, swapped);
 }
+
+size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp)
+{
+       struct perf_evsel *evsel;
+       size_t printed = 0;
+
+       list_for_each_entry(evsel, &evlist->entries, node) {
+               printed += fprintf(fp, "%s%s", evsel->idx ? ", " : "",
+                                  perf_evsel__name(evsel));
+       }
+
+       return printed + fprintf(fp, "\n");;
+}
index 2ed255792c6b3af3e3ec9c86e6e4e63b4893f6cc..3f2e1e4ccdd59dd480fc8164de88c361fee24c02 100644 (file)
@@ -143,4 +143,6 @@ static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist)
 {
        return list_entry(evlist->entries.prev, struct perf_evsel, node);
 }
+
+size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp);
 #endif /* __PERF_EVLIST_H */