aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-record.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e67226981834..94e210f86077 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -61,8 +61,6 @@ static bool call_graph = false;
61static bool inherit_stat = false; 61static bool inherit_stat = false;
62static bool no_samples = false; 62static bool no_samples = false;
63static bool sample_address = false; 63static bool sample_address = false;
64static bool multiplex = false;
65static int multiplex_fd = -1;
66 64
67static long samples = 0; 65static long samples = 0;
68static u64 bytes_written = 0; 66static u64 bytes_written = 0;
@@ -366,27 +364,19 @@ try_again:
366 */ 364 */
367 if (group && group_fd == -1) 365 if (group && group_fd == -1)
368 group_fd = fd[nr_cpu][counter][thread_index]; 366 group_fd = fd[nr_cpu][counter][thread_index];
369 if (multiplex && multiplex_fd == -1)
370 multiplex_fd = fd[nr_cpu][counter][thread_index];
371 367
372 if (multiplex && fd[nr_cpu][counter][thread_index] != multiplex_fd) { 368 event_array[nr_poll].fd = fd[nr_cpu][counter][thread_index];
373 369 event_array[nr_poll].events = POLLIN;
374 ret = ioctl(fd[nr_cpu][counter][thread_index], PERF_EVENT_IOC_SET_OUTPUT, multiplex_fd); 370 nr_poll++;
375 assert(ret != -1); 371
376 } else { 372 mmap_array[nr_cpu][counter][thread_index].counter = counter;
377 event_array[nr_poll].fd = fd[nr_cpu][counter][thread_index]; 373 mmap_array[nr_cpu][counter][thread_index].prev = 0;
378 event_array[nr_poll].events = POLLIN; 374 mmap_array[nr_cpu][counter][thread_index].mask = mmap_pages*page_size - 1;
379 nr_poll++; 375 mmap_array[nr_cpu][counter][thread_index].base = mmap(NULL, (mmap_pages+1)*page_size,
380 376 PROT_READ|PROT_WRITE, MAP_SHARED, fd[nr_cpu][counter][thread_index], 0);
381 mmap_array[nr_cpu][counter][thread_index].counter = counter; 377 if (mmap_array[nr_cpu][counter][thread_index].base == MAP_FAILED) {
382 mmap_array[nr_cpu][counter][thread_index].prev = 0; 378 error("failed to mmap with %d (%s)\n", errno, strerror(errno));
383 mmap_array[nr_cpu][counter][thread_index].mask = mmap_pages*page_size - 1; 379 exit(-1);
384 mmap_array[nr_cpu][counter][thread_index].base = mmap(NULL, (mmap_pages+1)*page_size,
385 PROT_READ|PROT_WRITE, MAP_SHARED, fd[nr_cpu][counter][thread_index], 0);
386 if (mmap_array[nr_cpu][counter][thread_index].base == MAP_FAILED) {
387 error("failed to mmap with %d (%s)\n", errno, strerror(errno));
388 exit(-1);
389 }
390 } 380 }
391 381
392 if (filter != NULL) { 382 if (filter != NULL) {
@@ -820,8 +810,6 @@ static const struct option options[] = {
820 "Sample addresses"), 810 "Sample addresses"),
821 OPT_BOOLEAN('n', "no-samples", &no_samples, 811 OPT_BOOLEAN('n', "no-samples", &no_samples,
822 "don't sample"), 812 "don't sample"),
823 OPT_BOOLEAN('M', "multiplex", &multiplex,
824 "multiplex counter output in a single channel"),
825 OPT_END() 813 OPT_END()
826}; 814};
827 815