Skip to contentSkip to conversation

perf tools: Only save the event formats we need

PATCH In review Frederic Weisbecker 1 participant 3 messages Aug 28, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Only save the event formats we need

While opening a trace event counter, every events are saved in the trace.info file. But we only want to save the specifications of the events we are using.

Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Steven Rostedt <[email protected]>
---
 tools/perf/builtin-record.c         |    4 +-
 tools/perf/util/parse-events.c      |   47 +++++++++++++++++++----
 tools/perf/util/parse-events.h      |   13 ++++++-
 tools/perf/util/trace-event-info.c  |   72 +++++++++++++++++++++++++++++------
 tools/perf/util/trace-event-parse.c |    1 +
 tools/perf/util/trace-event-read.c  |    1 +
 tools/perf/util/trace-event.h       |    9 ++--
 7 files changed, 120 insertions(+), 27 deletions(-)
tools/perf/builtin-record.c +2 -2
index acbe594..add514d 100644
@@ -549,11 +549,11 @@ static int __cmd_record(int argc, const char **argv)
 
 
 	if (raw_samples) {
-		read_tracing_data();
+		read_tracing_data(attrs, nr_counters);
 	} else {
 		for (i = 0; i < nr_counters; i++) {
 			if (attrs[i].sample_type & PERF_SAMPLE_RAW) {
-				read_tracing_data();
+				read_tracing_data(attrs, nr_counters);
 				break;
 			}
 		}
tools/perf/util/parse-events.c +39 -8

72 lines not on this page · raw message

tools/perf/util/parse-events.h +12 -1
index 9b1aeea..60704c1 100644
@@ -1,10 +1,19 @@
-
+#ifndef _PARSE_EVENTS_H
+#define _PARSE_EVENTS_H
 /*
  * Parse symbolic events/counts passed in as options:
  */
 
 struct option;
 
+struct tracepoint_path {
+	char *system;
+	char *name;
+	struct tracepoint_path *next;
+};
+
+extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
+
 extern int			nr_counters;
 
 extern struct perf_counter_attr attrs[MAX_COUNTERS];
@@ -21,3 +30,5 @@ extern void print_events(void);
 extern char debugfs_path[];
 extern int valid_debugfs_mount(const char *debugfs);
 
+
+#endif /* _PARSE_EVENTS_H */
tools/perf/util/trace-event-info.c +60 -12

145 lines not on this page · raw message

tools/perf/util/trace-event-parse.c +1 -0
index b53b27f..a6577cd 100644
@@ -29,6 +29,7 @@
 #include <errno.h>
 
 #undef _GNU_SOURCE
+#include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
 
tools/perf/util/trace-event-read.c +1 -0
index 1dac301..b12e490 100644
@@ -36,6 +36,7 @@
 #include <ctype.h>
 #include <errno.h>
 
+#include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
 
tools/perf/util/trace-event.h +5 -4
index 3ddb894..051fcf3 100644
@@ -1,6 +1,7 @@
-#ifndef _PARSE_EVENTS_H
-#define _PARSE_EVENTS_H
+#ifndef _TRACE_EVENTS_H
+#define _TRACE_EVENTS_H
 
+#include "parse-events.h"
 
 #define __unused __attribute__((unused))
 
@@ -233,6 +234,6 @@ extern int header_page_data_size;
 
 int parse_header_page(char *buf, unsigned long size);
 
-void read_tracing_data(void);
+void read_tracing_data(struct perf_counter_attr *pattrs, int nb_counters);
 
-#endif /* _PARSE_EVENTS_H */
+#endif /* _TRACE_EVENTS_H */
Signature · 1 line
1.6.2.3
#1 lore raw
Quoted 3 lines · Frederic Weisbecker

While opening a trace event counter, every events are saved in the trace.info file. But we only want to save the specifications of the events we are using.

I must confess I haven't done that because I care much about the amount of saved format, you can also beat me because this patch regress perf trace in that it won't support the trace appending mode anymore (for now).

That said, tracing/events/*/*/format is full of non trivial cases. perf trace was failing because it can't yet handle scalar dereference in the format arguments (since the recent sys_enter tracepoint add).

So what I plan toward this patch is to start iterating on trivial cases and make them work well without beeing annoyed by format fetching that are not supported yet.

#2 lore raw
In reply to Frederic Weisbecker
Commit-ID:  1ef2ed1066ae9f8080cd96cba11c2d41118b8792
Gitweb:     http://git.kernel.org/tip/1ef2ed1066ae9f8080cd96cba11c2d41118b8792
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Fri, 28 Aug 2009 03:09:58 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 28 Aug 2009 07:58:11 +0200

perf tools: Only save the event formats we need

While opening a trace event counter, every events are saved in the trace.info file. But we only want to save the specifications of the events we are using.

Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Steven Rostedt <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/builtin-record.c         |    4 +-
 tools/perf/util/parse-events.c      |   47 +++++++++++++++++++----
 tools/perf/util/parse-events.h      |   13 ++++++-
 tools/perf/util/trace-event-info.c  |   72 +++++++++++++++++++++++++++++------
 tools/perf/util/trace-event-parse.c |    1 +
 tools/perf/util/trace-event-read.c  |    1 +
 tools/perf/util/trace-event.h       |    9 ++--
 7 files changed, 120 insertions(+), 27 deletions(-)
tools/perf/builtin-record.c +2 -2
index acbe594..add514d 100644
@@ -549,11 +549,11 @@ static int __cmd_record(int argc, const char **argv)
 
 
 	if (raw_samples) {
-		read_tracing_data();
+		read_tracing_data(attrs, nr_counters);
 	} else {
 		for (i = 0; i < nr_counters; i++) {
 			if (attrs[i].sample_type & PERF_SAMPLE_RAW) {
-				read_tracing_data();
+				read_tracing_data(attrs, nr_counters);
 				break;
 			}
 		}
tools/perf/util/parse-events.c +39 -8

72 lines not on this page · raw message

tools/perf/util/parse-events.h +12 -1
index 9b1aeea..60704c1 100644
@@ -1,10 +1,19 @@
-
+#ifndef _PARSE_EVENTS_H
+#define _PARSE_EVENTS_H
 /*
  * Parse symbolic events/counts passed in as options:
  */
 
 struct option;
 
+struct tracepoint_path {
+	char *system;
+	char *name;
+	struct tracepoint_path *next;
+};
+
+extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
+
 extern int			nr_counters;
 
 extern struct perf_counter_attr attrs[MAX_COUNTERS];
@@ -21,3 +30,5 @@ extern void print_events(void);
 extern char debugfs_path[];
 extern int valid_debugfs_mount(const char *debugfs);
 
+
+#endif /* _PARSE_EVENTS_H */
tools/perf/util/trace-event-info.c +60 -12

145 lines not on this page · raw message

tools/perf/util/trace-event-parse.c +1 -0
index b53b27f..a6577cd 100644
@@ -29,6 +29,7 @@
 #include <errno.h>
 
 #undef _GNU_SOURCE
+#include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
 
tools/perf/util/trace-event-read.c +1 -0
index 1dac301..b12e490 100644
@@ -36,6 +36,7 @@
 #include <ctype.h>
 #include <errno.h>
 
+#include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
 
tools/perf/util/trace-event.h +5 -4
index 3ddb894..051fcf3 100644
@@ -1,6 +1,7 @@
-#ifndef _PARSE_EVENTS_H
-#define _PARSE_EVENTS_H
+#ifndef _TRACE_EVENTS_H
+#define _TRACE_EVENTS_H
 
+#include "parse-events.h"
 
 #define __unused __attribute__((unused))
 
@@ -233,6 +234,6 @@ extern int header_page_data_size;
 
 int parse_header_page(char *buf, unsigned long size);
 
-void read_tracing_data(void);
+void read_tracing_data(struct perf_counter_attr *pattrs, int nb_counters);
 
-#endif /* _PARSE_EVENTS_H */
+#endif /* _TRACE_EVENTS_H */