diff options
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 7a6a85f9fea6..a7111871440e 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -2037,6 +2037,37 @@ int symbol__annotate_fprintf2(struct symbol *sym, FILE *fp) | |||
2037 | return 0; | 2037 | return 0; |
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | int map_symbol__annotation_dump(struct map_symbol *ms, struct perf_evsel *evsel) | ||
2041 | { | ||
2042 | const char *ev_name = perf_evsel__name(evsel); | ||
2043 | char buf[1024]; | ||
2044 | char *filename; | ||
2045 | int err = -1; | ||
2046 | FILE *fp; | ||
2047 | |||
2048 | if (asprintf(&filename, "%s.annotation", ms->sym->name) < 0) | ||
2049 | return -1; | ||
2050 | |||
2051 | fp = fopen(filename, "w"); | ||
2052 | if (fp == NULL) | ||
2053 | goto out_free_filename; | ||
2054 | |||
2055 | if (perf_evsel__is_group_event(evsel)) { | ||
2056 | perf_evsel__group_desc(evsel, buf, sizeof(buf)); | ||
2057 | ev_name = buf; | ||
2058 | } | ||
2059 | |||
2060 | fprintf(fp, "%s() %s\nEvent: %s\n\n", | ||
2061 | ms->sym->name, ms->map->dso->long_name, ev_name); | ||
2062 | symbol__annotate_fprintf2(ms->sym, fp); | ||
2063 | |||
2064 | fclose(fp); | ||
2065 | err = 0; | ||
2066 | out_free_filename: | ||
2067 | free(filename); | ||
2068 | return err; | ||
2069 | } | ||
2070 | |||
2040 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx) | 2071 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx) |
2041 | { | 2072 | { |
2042 | struct annotation *notes = symbol__annotation(sym); | 2073 | struct annotation *notes = symbol__annotation(sym); |