perf tools: Add perf_event__fprintf_event_update function
To display a 'event update' event for raw dump. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Kan Liang <kan.liang@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1445784728-21732-26-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
86ebb09f96
commit
c853f9394b
|
@ -2793,6 +2793,44 @@ perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp)
|
||||||
|
{
|
||||||
|
struct event_update_event *ev = &event->event_update;
|
||||||
|
struct event_update_event_scale *ev_scale;
|
||||||
|
struct event_update_event_cpus *ev_cpus;
|
||||||
|
struct cpu_map *map;
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
|
ret = fprintf(fp, "\n... id: %" PRIu64 "\n", ev->id);
|
||||||
|
|
||||||
|
switch (ev->type) {
|
||||||
|
case PERF_EVENT_UPDATE__SCALE:
|
||||||
|
ev_scale = (struct event_update_event_scale *) ev->data;
|
||||||
|
ret += fprintf(fp, "... scale: %f\n", ev_scale->scale);
|
||||||
|
break;
|
||||||
|
case PERF_EVENT_UPDATE__UNIT:
|
||||||
|
ret += fprintf(fp, "... unit: %s\n", ev->data);
|
||||||
|
break;
|
||||||
|
case PERF_EVENT_UPDATE__NAME:
|
||||||
|
ret += fprintf(fp, "... name: %s\n", ev->data);
|
||||||
|
break;
|
||||||
|
case PERF_EVENT_UPDATE__CPUS:
|
||||||
|
ev_cpus = (struct event_update_event_cpus *) ev->data;
|
||||||
|
ret += fprintf(fp, "... ");
|
||||||
|
|
||||||
|
map = cpu_map__new_data(&ev_cpus->cpus);
|
||||||
|
if (map)
|
||||||
|
ret += cpu_map__fprintf(map, fp);
|
||||||
|
else
|
||||||
|
ret += fprintf(fp, "failed to get cpus\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret += fprintf(fp, "... unknown type\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int perf_event__synthesize_attrs(struct perf_tool *tool,
|
int perf_event__synthesize_attrs(struct perf_tool *tool,
|
||||||
struct perf_session *session,
|
struct perf_session *session,
|
||||||
|
|
|
@ -122,6 +122,7 @@ int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
|
||||||
int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,
|
int perf_event__process_event_update(struct perf_tool *tool __maybe_unused,
|
||||||
union perf_event *event,
|
union perf_event *event,
|
||||||
struct perf_evlist **pevlist);
|
struct perf_evlist **pevlist);
|
||||||
|
size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp);
|
||||||
|
|
||||||
int perf_event__synthesize_tracing_data(struct perf_tool *tool,
|
int perf_event__synthesize_tracing_data(struct perf_tool *tool,
|
||||||
int fd, struct perf_evlist *evlist,
|
int fd, struct perf_evlist *evlist,
|
||||||
|
|
Loading…
Reference in New Issue