aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-03-12 04:20:57 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-12 04:20:59 -0500
commit937779db13fb6cb621e28d9ae0a6cf1d05b57d05 (patch)
tree6c27402677c347c4dc01980de78c270630588847 /tools/perf/builtin-record.c
parent6230f2c7ef01a69e2ba9370326572c287209d32a (diff)
parent9f591fd76afdc0e5192e9ed00a36f8efc0b4dfe6 (diff)
Merge branch 'perf/urgent' into perf/core
Merge reason: We want to queue up a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6e4a39328b33..bed175d59e55 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -22,6 +22,7 @@
22#include "util/debug.h" 22#include "util/debug.h"
23#include "util/session.h" 23#include "util/session.h"
24#include "util/symbol.h" 24#include "util/symbol.h"
25#include "util/cpumap.h"
25 26
26#include <unistd.h> 27#include <unistd.h>
27#include <sched.h> 28#include <sched.h>
@@ -244,6 +245,9 @@ static void create_counter(int counter, int cpu, pid_t pid)
244 245
245 attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID; 246 attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
246 247
248 if (nr_counters > 1)
249 attr->sample_type |= PERF_SAMPLE_ID;
250
247 if (freq) { 251 if (freq) {
248 attr->sample_type |= PERF_SAMPLE_PERIOD; 252 attr->sample_type |= PERF_SAMPLE_PERIOD;
249 attr->freq = 1; 253 attr->freq = 1;
@@ -392,6 +396,9 @@ static int process_buildids(void)
392{ 396{
393 u64 size = lseek(output, 0, SEEK_CUR); 397 u64 size = lseek(output, 0, SEEK_CUR);
394 398
399 if (size == 0)
400 return 0;
401
395 session->fd = output; 402 session->fd = output;
396 return __perf_session__process_events(session, post_processing_offset, 403 return __perf_session__process_events(session, post_processing_offset,
397 size - post_processing_offset, 404 size - post_processing_offset,
@@ -419,9 +426,6 @@ static int __cmd_record(int argc, const char **argv)
419 char buf; 426 char buf;
420 427
421 page_size = sysconf(_SC_PAGE_SIZE); 428 page_size = sysconf(_SC_PAGE_SIZE);
422 nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
423 assert(nr_cpus <= MAX_NR_CPUS);
424 assert(nr_cpus >= 0);
425 429
426 atexit(sig_atexit); 430 atexit(sig_atexit);
427 signal(SIGCHLD, sig_handler); 431 signal(SIGCHLD, sig_handler);
@@ -545,8 +549,9 @@ static int __cmd_record(int argc, const char **argv)
545 if ((!system_wide && !inherit) || profile_cpu != -1) { 549 if ((!system_wide && !inherit) || profile_cpu != -1) {
546 open_counters(profile_cpu, target_pid); 550 open_counters(profile_cpu, target_pid);
547 } else { 551 } else {
552 nr_cpus = read_cpu_map();
548 for (i = 0; i < nr_cpus; i++) 553 for (i = 0; i < nr_cpus; i++)
549 open_counters(i, target_pid); 554 open_counters(cpumap[i], target_pid);
550 } 555 }
551 556
552 if (file_new) { 557 if (file_new) {