diff options
Diffstat (limited to 'tools/perf/builtin-kmem.c')
-rw-r--r-- | tools/perf/builtin-kmem.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 047fef74bd52..f218990de0cd 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -320,35 +320,23 @@ process_raw_event(event_t *raw_event __used, void *more_data, | |||
320 | 320 | ||
321 | static int process_sample_event(event_t *event) | 321 | static int process_sample_event(event_t *event) |
322 | { | 322 | { |
323 | u64 ip = event->ip.ip; | 323 | struct sample_data data; |
324 | u64 timestamp = -1; | 324 | struct thread *thread; |
325 | u32 cpu = -1; | ||
326 | u64 period = 1; | ||
327 | void *more_data = event->ip.__more_data; | ||
328 | struct thread *thread = threads__findnew(event->ip.pid); | ||
329 | |||
330 | if (sample_type & PERF_SAMPLE_TIME) { | ||
331 | timestamp = *(u64 *)more_data; | ||
332 | more_data += sizeof(u64); | ||
333 | } | ||
334 | 325 | ||
335 | if (sample_type & PERF_SAMPLE_CPU) { | 326 | memset(&data, 0, sizeof(data)); |
336 | cpu = *(u32 *)more_data; | 327 | data.time = -1; |
337 | more_data += sizeof(u32); | 328 | data.cpu = -1; |
338 | more_data += sizeof(u32); /* reserved */ | 329 | data.period = 1; |
339 | } | ||
340 | 330 | ||
341 | if (sample_type & PERF_SAMPLE_PERIOD) { | 331 | event__parse_sample(event, sample_type, &data); |
342 | period = *(u64 *)more_data; | ||
343 | more_data += sizeof(u64); | ||
344 | } | ||
345 | 332 | ||
346 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", | 333 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", |
347 | event->header.misc, | 334 | event->header.misc, |
348 | event->ip.pid, event->ip.tid, | 335 | data.pid, data.tid, |
349 | (void *)(long)ip, | 336 | (void *)(long)data.ip, |
350 | (long long)period); | 337 | (long long)data.period); |
351 | 338 | ||
339 | thread = threads__findnew(event->ip.pid); | ||
352 | if (thread == NULL) { | 340 | if (thread == NULL) { |
353 | pr_debug("problem processing %d event, skipping it.\n", | 341 | pr_debug("problem processing %d event, skipping it.\n", |
354 | event->header.type); | 342 | event->header.type); |
@@ -357,7 +345,7 @@ static int process_sample_event(event_t *event) | |||
357 | 345 | ||
358 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); | 346 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); |
359 | 347 | ||
360 | process_raw_event(event, more_data, cpu, timestamp, thread); | 348 | process_raw_event(event, data.raw_data, data.cpu, data.time, thread); |
361 | 349 | ||
362 | return 0; | 350 | return 0; |
363 | } | 351 | } |