[PATCH 24/57] perf tools: Add perf_event__fprintf_attr_update function
From: Jiri Olsa
Date: Fri Oct 16 2015 - 06:53:04 EST
To display attr_update event for raw dump.
Link: http://lkml.kernel.org/n/tip-ch2nor544486ppvwscqg55ik@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/header.c | 38 ++++++++++++++++++++++++++++++++++++++
tools/perf/util/header.h | 1 +
2 files changed, 39 insertions(+)
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 83c3bbd05b80..ad844f37b662 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2793,6 +2793,44 @@ perf_event__synthesize_attr_update_cpus(struct perf_tool *tool,
return err;
}
+size_t perf_event__fprintf_attr_update(union perf_event *event, FILE *fp)
+{
+ struct attr_update_event *ev = &event->attr_update;
+ struct attr_update_event_scale *ev_scale;
+ struct attr_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_ATTR_UPDATE__SCALE:
+ ev_scale = (struct attr_update_event_scale *) ev->data;
+ ret += fprintf(fp, "... scale: %f\n", ev_scale->scale);
+ break;
+ case PERF_ATTR_UPDATE__UNIT:
+ ret += fprintf(fp, "... unit: %s\n", ev->data);
+ break;
+ case PERF_ATTR_UPDATE__NAME:
+ ret += fprintf(fp, "... name: %s\n", ev->data);
+ break;
+ case PERF_ATTR_UPDATE__CPUS:
+ ev_cpus = (struct attr_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,
struct perf_session *session,
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index db673b0cef41..97384e24907c 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -122,6 +122,7 @@ int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
int perf_event__process_attr_update(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_evlist **pevlist);
+size_t perf_event__fprintf_attr_update(union perf_event *event, FILE *fp);
int perf_event__synthesize_tracing_data(struct perf_tool *tool,
int fd, struct perf_evlist *evlist,
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/