diff options
Diffstat (limited to 'tools/perf/builtin-kmem.c')
-rw-r--r-- | tools/perf/builtin-kmem.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 35722fafc4d1..e7294c8fc620 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -33,9 +33,6 @@ static bool raw_ip; | |||
33 | 33 | ||
34 | static char default_sort_order[] = "frag,hit,bytes"; | 34 | static char default_sort_order[] = "frag,hit,bytes"; |
35 | 35 | ||
36 | static char *cwd; | ||
37 | static int cwdlen; | ||
38 | |||
39 | static int *cpunode_map; | 36 | static int *cpunode_map; |
40 | static int max_cpu_num; | 37 | static int max_cpu_num; |
41 | 38 | ||
@@ -126,25 +123,6 @@ static void setup_cpunode_map(void) | |||
126 | } | 123 | } |
127 | } | 124 | } |
128 | 125 | ||
129 | static int | ||
130 | process_comm_event(event_t *event, unsigned long offset, unsigned long head) | ||
131 | { | ||
132 | struct thread *thread = threads__findnew(event->comm.pid); | ||
133 | |||
134 | dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n", | ||
135 | (void *)(offset + head), | ||
136 | (void *)(long)(event->header.size), | ||
137 | event->comm.comm, event->comm.pid); | ||
138 | |||
139 | if (thread == NULL || | ||
140 | thread__set_comm(thread, event->comm.comm)) { | ||
141 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); | ||
142 | return -1; | ||
143 | } | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static void insert_alloc_stat(unsigned long call_site, unsigned long ptr, | 126 | static void insert_alloc_stat(unsigned long call_site, unsigned long ptr, |
149 | int bytes_req, int bytes_alloc, int cpu) | 127 | int bytes_req, int bytes_alloc, int cpu) |
150 | { | 128 | { |
@@ -340,8 +318,7 @@ process_raw_event(event_t *raw_event __used, void *more_data, | |||
340 | } | 318 | } |
341 | } | 319 | } |
342 | 320 | ||
343 | static int | 321 | static int process_sample_event(event_t *event) |
344 | process_sample_event(event_t *event, unsigned long offset, unsigned long head) | ||
345 | { | 322 | { |
346 | u64 ip = event->ip.ip; | 323 | u64 ip = event->ip.ip; |
347 | u64 timestamp = -1; | 324 | u64 timestamp = -1; |
@@ -366,9 +343,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
366 | more_data += sizeof(u64); | 343 | more_data += sizeof(u64); |
367 | } | 344 | } |
368 | 345 | ||
369 | dump_printf("%p [%p]: PERF_RECORD_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", | 346 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", |
370 | (void *)(offset + head), | ||
371 | (void *)(long)(event->header.size), | ||
372 | event->header.misc, | 347 | event->header.misc, |
373 | event->ip.pid, event->ip.tid, | 348 | event->ip.pid, event->ip.tid, |
374 | (void *)(long)ip, | 349 | (void *)(long)ip, |
@@ -403,7 +378,7 @@ static int sample_type_check(u64 type) | |||
403 | 378 | ||
404 | static struct perf_file_handler file_handler = { | 379 | static struct perf_file_handler file_handler = { |
405 | .process_sample_event = process_sample_event, | 380 | .process_sample_event = process_sample_event, |
406 | .process_comm_event = process_comm_event, | 381 | .process_comm_event = event__process_comm, |
407 | .sample_type_check = sample_type_check, | 382 | .sample_type_check = sample_type_check, |
408 | }; | 383 | }; |
409 | 384 | ||
@@ -413,7 +388,7 @@ static int read_events(void) | |||
413 | register_perf_file_handler(&file_handler); | 388 | register_perf_file_handler(&file_handler); |
414 | 389 | ||
415 | return mmap_dispatch_perf_file(&header, input_name, 0, 0, | 390 | return mmap_dispatch_perf_file(&header, input_name, 0, 0, |
416 | &cwdlen, &cwd); | 391 | &event__cwdlen, &event__cwd); |
417 | } | 392 | } |
418 | 393 | ||
419 | static double fragmentation(unsigned long n_req, unsigned long n_alloc) | 394 | static double fragmentation(unsigned long n_req, unsigned long n_alloc) |