diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-06 13:54:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-06 13:54:11 -0400 |
commit | 78f067b38bed1adce6a2fa7868cf8ea37d61f537 (patch) | |
tree | a5083b34819120eec26a5151227641f68e4e89a1 /tools | |
parent | 42e1fb776087713b5482cd7cf6cac998fbdd6544 (diff) |
perf evlist: Add fprintf method
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evlist.c | 13 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 4774ac1e3d5f..892353729c7a 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -889,3 +889,16 @@ int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *even | |||
889 | struct perf_evsel *evsel = perf_evlist__first(evlist); | 889 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
890 | return perf_evsel__parse_sample(evsel, event, sample, swapped); | 890 | return perf_evsel__parse_sample(evsel, event, sample, swapped); |
891 | } | 891 | } |
892 | |||
893 | size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp) | ||
894 | { | ||
895 | struct perf_evsel *evsel; | ||
896 | size_t printed = 0; | ||
897 | |||
898 | list_for_each_entry(evsel, &evlist->entries, node) { | ||
899 | printed += fprintf(fp, "%s%s", evsel->idx ? ", " : "", | ||
900 | perf_evsel__name(evsel)); | ||
901 | } | ||
902 | |||
903 | return printed + fprintf(fp, "\n");; | ||
904 | } | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 2ed255792c6b..3f2e1e4ccdd5 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -143,4 +143,6 @@ static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) | |||
143 | { | 143 | { |
144 | return list_entry(evlist->entries.prev, struct perf_evsel, node); | 144 | return list_entry(evlist->entries.prev, struct perf_evsel, node); |
145 | } | 145 | } |
146 | |||
147 | size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp); | ||
146 | #endif /* __PERF_EVLIST_H */ | 148 | #endif /* __PERF_EVLIST_H */ |