aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-04-05 18:47:56 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2012-04-25 07:28:48 -0400
commitaaf045f72335653b24784d6042be8e4aee114403 (patch)
tree55c11335e23759e56e0a5ae2daf1c31bb9769662 /tools/perf
parent668fe01f1cea2154da479dd12946eeb53413396e (diff)
perf: Have perf use the new libtraceevent.a library
The event parsing code in perf was originally copied from trace-cmd but never was kept up-to-date with the changes that was done there. The trace-cmd libtraceevent.a code is much more mature than what is currently in perf. This updates the code to use wrappers to handle the calls to the new event parsing code. The new code requires a handle to be pass around, which removes the global event variables and allows more than one event structure to be read from different files (and different machines). But perf still has the old global events and the code throughout perf does not yet have a nice way to pass around a handle. A global 'pevent' has been made for perf and the old calls have been created as wrappers to the new event parsing code that uses the global pevent. With this change, perf can later incorporate the pevent handle into the perf structures and allow more than one file to be read and compared, that contains different events. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile20
-rw-r--r--tools/perf/builtin-kmem.c6
-rw-r--r--tools/perf/builtin-lock.c26
-rw-r--r--tools/perf/builtin-sched.c42
-rw-r--r--tools/perf/builtin-script.c2
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c16
-rw-r--r--tools/perf/util/trace-event-info.c4
-rw-r--r--tools/perf/util/trace-event-parse.c350
-rw-r--r--tools/perf/util/trace-event-read.c34
-rw-r--r--tools/perf/util/trace-event.h50
-rw-r--r--tools/perf/util/trace-parse-events.c3125
-rw-r--r--tools/perf/util/trace-parse-events.h273
12 files changed, 481 insertions, 3467 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 46150ab073c7..af0e5d64a9f7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -149,7 +149,7 @@ endif
149 149
150### --- END CONFIGURATION SECTION --- 150### --- END CONFIGURATION SECTION ---
151 151
152BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 152BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -I$(EVENT_PARSE_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
153BASIC_LDFLAGS = 153BASIC_LDFLAGS =
154 154
155# Guard against environment variables 155# Guard against environment variables
@@ -179,7 +179,15 @@ $(OUTPUT)python/perf.so: $(PYRF_OBJS) $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
179SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) 179SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
180 180
181EVENT_PARSE_DIR = ../lib/traceevent/ 181EVENT_PARSE_DIR = ../lib/traceevent/
182LIBTRACEEVENT = $(OUTPUT)$(EVENT_PARSE_DIR)libtraceevent.a 182
183ifeq ("$(origin O)", "command line")
184 EP_PATH=$(OUTPUT)/
185else
186 EP_PATH=$(EVENT_PARSE_DIR)/
187endif
188
189LIBPARSEVENT = $(EP_PATH)libtraceevent.a
190EP_LIB := -L$(EP_PATH) -ltraceevent
183 191
184# 192#
185# Single 'perf' binary right now: 193# Single 'perf' binary right now:
@@ -295,7 +303,6 @@ LIB_H += util/hist.h
295LIB_H += util/thread.h 303LIB_H += util/thread.h
296LIB_H += util/thread_map.h 304LIB_H += util/thread_map.h
297LIB_H += util/trace-event.h 305LIB_H += util/trace-event.h
298LIB_H += util/trace-parse-events.h
299LIB_H += util/probe-finder.h 306LIB_H += util/probe-finder.h
300LIB_H += util/dwarf-aux.h 307LIB_H += util/dwarf-aux.h
301LIB_H += util/probe-event.h 308LIB_H += util/probe-event.h
@@ -358,7 +365,6 @@ LIB_OBJS += $(OUTPUT)util/pmu-bison.o
358LIB_OBJS += $(OUTPUT)util/trace-event-read.o 365LIB_OBJS += $(OUTPUT)util/trace-event-read.o
359LIB_OBJS += $(OUTPUT)util/trace-event-info.o 366LIB_OBJS += $(OUTPUT)util/trace-event-info.o
360LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o 367LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
361LIB_OBJS += $(OUTPUT)util/trace-parse-events.o
362LIB_OBJS += $(OUTPUT)util/svghelper.o 368LIB_OBJS += $(OUTPUT)util/svghelper.o
363LIB_OBJS += $(OUTPUT)util/sort.o 369LIB_OBJS += $(OUTPUT)util/sort.o
364LIB_OBJS += $(OUTPUT)util/hist.o 370LIB_OBJS += $(OUTPUT)util/hist.o
@@ -402,7 +408,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
402BUILTIN_OBJS += $(OUTPUT)builtin-test.o 408BUILTIN_OBJS += $(OUTPUT)builtin-test.o
403BUILTIN_OBJS += $(OUTPUT)builtin-inject.o 409BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
404 410
405PERFLIBS = $(LIB_FILE) 411PERFLIBS = $(LIB_FILE) $(LIBPARSEVENT)
406 412
407# Files needed for the python binding, perf.so 413# Files needed for the python binding, perf.so
408# pyrf is just an internal name needed for all those wrappers. 414# pyrf is just an internal name needed for all those wrappers.
@@ -699,7 +705,7 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
699 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ 705 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
700 $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@ 706 $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@
701 707
702$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) $(LIBTRACEEVENT) 708$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
703 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ 709 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
704 $(BUILTIN_OBJS) $(LIBS) -o $@ 710 $(BUILTIN_OBJS) $(LIBS) -o $@
705 711
@@ -806,7 +812,7 @@ $(LIB_FILE): $(LIB_OBJS)
806 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) 812 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
807 813
808# libparsevent.a 814# libparsevent.a
809$(LIBTRACEEVENT): 815$(LIBPARSEVENT):
810 make -C $(EVENT_PARSE_DIR) $(COMMAND_O) libtraceevent.a 816 make -C $(EVENT_PARSE_DIR) $(COMMAND_O) libtraceevent.a
811 817
812help: 818help:
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 39104c0beea3..547af48deb4f 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -192,7 +192,7 @@ static void insert_caller_stat(unsigned long call_site,
192} 192}
193 193
194static void process_alloc_event(void *data, 194static void process_alloc_event(void *data,
195 struct event *event, 195 struct event_format *event,
196 int cpu, 196 int cpu,
197 u64 timestamp __used, 197 u64 timestamp __used,
198 struct thread *thread __used, 198 struct thread *thread __used,
@@ -253,7 +253,7 @@ static struct alloc_stat *search_alloc_stat(unsigned long ptr,
253} 253}
254 254
255static void process_free_event(void *data, 255static void process_free_event(void *data,
256 struct event *event, 256 struct event_format *event,
257 int cpu, 257 int cpu,
258 u64 timestamp __used, 258 u64 timestamp __used,
259 struct thread *thread __used) 259 struct thread *thread __used)
@@ -281,7 +281,7 @@ static void process_free_event(void *data,
281static void process_raw_event(union perf_event *raw_event __used, void *data, 281static void process_raw_event(union perf_event *raw_event __used, void *data,
282 int cpu, u64 timestamp, struct thread *thread) 282 int cpu, u64 timestamp, struct thread *thread)
283{ 283{
284 struct event *event; 284 struct event_format *event;
285 int type; 285 int type;
286 286
287 type = trace_parse_common_type(data); 287 type = trace_parse_common_type(data);
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 12c814838993..fd53319de20d 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -356,25 +356,25 @@ struct trace_release_event {
356 356
357struct trace_lock_handler { 357struct trace_lock_handler {
358 void (*acquire_event)(struct trace_acquire_event *, 358 void (*acquire_event)(struct trace_acquire_event *,
359 struct event *, 359 struct event_format *,
360 int cpu, 360 int cpu,
361 u64 timestamp, 361 u64 timestamp,
362 struct thread *thread); 362 struct thread *thread);
363 363
364 void (*acquired_event)(struct trace_acquired_event *, 364 void (*acquired_event)(struct trace_acquired_event *,
365 struct event *, 365 struct event_format *,
366 int cpu, 366 int cpu,
367 u64 timestamp, 367 u64 timestamp,
368 struct thread *thread); 368 struct thread *thread);
369 369
370 void (*contended_event)(struct trace_contended_event *, 370 void (*contended_event)(struct trace_contended_event *,
371 struct event *, 371 struct event_format *,
372 int cpu, 372 int cpu,
373 u64 timestamp, 373 u64 timestamp,
374 struct thread *thread); 374 struct thread *thread);
375 375
376 void (*release_event)(struct trace_release_event *, 376 void (*release_event)(struct trace_release_event *,
377 struct event *, 377 struct event_format *,
378 int cpu, 378 int cpu,
379 u64 timestamp, 379 u64 timestamp,
380 struct thread *thread); 380 struct thread *thread);
@@ -416,7 +416,7 @@ enum acquire_flags {
416 416
417static void 417static void
418report_lock_acquire_event(struct trace_acquire_event *acquire_event, 418report_lock_acquire_event(struct trace_acquire_event *acquire_event,
419 struct event *__event __used, 419 struct event_format *__event __used,