diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-03-15 23:14:51 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-03-20 15:36:18 -0300 |
commit | c298304bd747d6a0b733f0becb470ff07ead0317 (patch) | |
tree | 41bd9879719d1305d2d201e64109d6f883c5f2eb /tools/perf/util/annotate.h | |
parent | a1e9b74cc2ef80131b9f955c0e1acc25285dc88c (diff) | |
download | op-kernel-dev-c298304bd747d6a0b733f0becb470ff07ead0317.zip op-kernel-dev-c298304bd747d6a0b733f0becb470ff07ead0317.tar.gz |
perf annotate: Use a ops table for annotation_line__write()
To simplify the passing of arguments, the --stdio2 code will have to set
all the fields with operations printing to stdout.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-pcs3c7vdy9ucygxflo4nl1o7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r-- | tools/perf/util/annotate.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 27fcdac..6fbb34b 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -125,15 +125,20 @@ void disasm_line__free(struct disasm_line *dl); struct annotation_line * annotation_line__next(struct annotation_line *pos, struct list_head *head); +struct annotation_write_ops { + bool first_line, current_entry, change_color; + int width; + void *obj; + int (*set_color)(void *obj, int color); + void (*set_percent_color)(void *obj, double percent, bool current); + int (*set_jumps_percent_color)(void *obj, int nr, bool current); + void (*printf)(void *obj, const char *fmt, ...); + void (*write_graph)(void *obj, int graph); +}; + double annotation_line__max_percent(struct annotation_line *al, struct annotation *notes); void annotation_line__write(struct annotation_line *al, struct annotation *notes, - bool first_line, bool current_entry, bool change_color, int width, - void *obj, - int (*obj__set_color)(void *obj, int color), - void (*obj__set_percent_color)(void *obj, double percent, bool current), - int (*obj__set_jumps_percent_color)(void *obj, int nr, bool current), - void (*obj__printf)(void *obj, const char *fmt, ...), - void (*obj__write_graph)(void *obj, int graph)); + struct annotation_write_ops *ops); int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw); size_t disasm__fprintf(struct list_head *head, FILE *fp); |