diff options
| author | Ingo Molnar <mingo@kernel.org> | 2014-12-08 05:50:24 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-12-08 05:50:24 -0500 |
| commit | 2a2662bf88e693d477ef08351d03934f7bc0b51c (patch) | |
| tree | cef243df159cc12ada7e97998a253df7c0abb2a2 /tools/perf/util/scripting-engines/trace-event-perl.c | |
| parent | b2776bf7149bddd1f4161f14f79520f17fc1d71d (diff) | |
| parent | 36748b9518a2437beffe861b47dff6d12b736b3f (diff) | |
Merge branch 'perf/core-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks into perf/hw_breakpoints
Pull AMD range breakpoints support from Frederic Weisbecker:
" - Extend breakpoint tools and core to support address range through perf
event with initial backend support for AMD extended breakpoints.
Syntax is:
perf record -e mem:addr/len:type
For example set write breakpoint from 0x1000 to 0x1200 (0x1000 + 512)
perf record -e mem:0x1000/512:w
- Clean up a bit breakpoint code validation
It has been acked by Jiri and Oleg. "
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-perl.c')
| -rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 0a01bac4ce02..22ebc46226e7 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | #include <ctype.h> | 25 | #include <ctype.h> |
| 26 | #include <errno.h> | 26 | #include <errno.h> |
| 27 | #include <linux/bitmap.h> | ||
| 27 | 28 | ||
| 28 | #include "../util.h" | 29 | #include "../util.h" |
| 29 | #include <EXTERN.h> | 30 | #include <EXTERN.h> |
| @@ -57,7 +58,7 @@ INTERP my_perl; | |||
| 57 | #define FTRACE_MAX_EVENT \ | 58 | #define FTRACE_MAX_EVENT \ |
| 58 | ((1 << (sizeof(unsigned short) * 8)) - 1) | 59 | ((1 << (sizeof(unsigned short) * 8)) - 1) |
| 59 | 60 | ||
| 60 | struct event_format *events[FTRACE_MAX_EVENT]; | 61 | static DECLARE_BITMAP(events_defined, FTRACE_MAX_EVENT); |
| 61 | 62 | ||
| 62 | extern struct scripting_context *scripting_context; | 63 | extern struct scripting_context *scripting_context; |
| 63 | 64 | ||
| @@ -238,35 +239,15 @@ static void define_event_symbols(struct event_format *event, | |||
| 238 | define_event_symbols(event, ev_name, args->next); | 239 | define_event_symbols(event, ev_name, args->next); |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | static inline struct event_format *find_cache_event(struct perf_evsel *evsel) | ||
| 242 | { | ||
| 243 | static char ev_name[256]; | ||
| 244 | struct event_format *event; | ||
| 245 | int type = evsel->attr.config; | ||
| 246 | |||
| 247 | if (events[type]) | ||
| 248 | return events[type]; | ||
| 249 | |||
| 250 | events[type] = event = evsel->tp_format; | ||
| 251 | if (!event) | ||
| 252 | return NULL; | ||
| 253 | |||
| 254 | sprintf(ev_name, "%s::%s", event->system, event->name); | ||
| 255 | |||
| 256 | define_event_symbols(event, ev_name, event->print_fmt.args); | ||
| 257 | |||
| 258 | return event; | ||
| 259 | } | ||
| 260 | |||
| 261 | static void perl_process_tracepoint(struct perf_sample *sample, | 242 | static void perl_process_tracepoint(struct perf_sample *sample, |
| 262 | struct perf_evsel *evsel, | 243 | struct perf_evsel *evsel, |
| 263 | struct thread *thread) | 244 | struct thread *thread) |
| 264 | { | 245 | { |
| 246 | struct event_format *event = evsel->tp_format; | ||
| 265 | struct format_field *field; | 247 | struct format_field *field; |
| 266 | static char handler[256]; | 248 | static char handler[256]; |
| 267 | unsigned long long val; | 249 | unsigned long long val; |
| 268 | unsigned long s, ns; | 250 | unsigned long s, ns; |
| 269 | struct event_format *event; | ||
| 270 | int pid; | 251 | int pid; |
| 271 | int cpu = sample->cpu; | 252 | int cpu = sample->cpu; |
| 272 | void *data = sample->raw_data; | 253 | void *data = sample->raw_data; |
| @@ -278,7 +259,6 @@ static void perl_process_tracepoint(struct perf_sample *sample, | |||
| 278 | if (evsel->attr.type != PERF_TYPE_TRACEPOINT) | 259 | if (evsel->attr.type != PERF_TYPE_TRACEPOINT) |
| 279 | return; | 260 | return; |
| 280 | 261 | ||
| 281 | event = find_cache_event(evsel); | ||
| 282 | if (!event) | 262 | if (!event) |
| 283 | die("ug! no event found for type %" PRIu64, (u64)evsel->attr.config); | 263 | die("ug! no event found for type %" PRIu64, (u64)evsel->attr.config); |
| 284 | 264 | ||
| @@ -286,6 +266,9 @@ static void perl_process_tracepoint(struct perf_sample *sample, | |||
| 286 | 266 | ||
| 287 | sprintf(handler, "%s::%s", event->system, event->name); | 267 | sprintf(handler, "%s::%s", event->system, event->name); |
| 288 | 268 | ||
| 269 | if (!test_and_set_bit(event->id, events_defined)) | ||
| 270 | define_event_symbols(event, handler, event->print_fmt.args); | ||
| 271 | |||
| 289 | s = nsecs / NSECS_PER_SEC; | 272 | s = nsecs / NSECS_PER_SEC; |
| 290 | ns = nsecs - s * NSECS_PER_SEC; | 273 | ns = nsecs - s * NSECS_PER_SEC; |
| 291 | 274 | ||
