瀏覽代碼

perf tools: Add a general option to enable raw sample records

While we can enable the perf sample records per tracepoint
counter, we may also want to enable this option for every
tracepoint counters to open, so that we don't need to add a
:record flag for all of them.

Add the -R, --raw-samples options for this purpose.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250152039-7284-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Frederic Weisbecker 15 年之前
父節點
當前提交
daac07b2e6
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      tools/perf/builtin-record.c

+ 5 - 0
tools/perf/builtin-record.c

@@ -34,6 +34,7 @@ static int			output;
 static const char		*output_name			= "perf.data";
 static const char		*output_name			= "perf.data";
 static int			group				= 0;
 static int			group				= 0;
 static unsigned int		realtime_prio			= 0;
 static unsigned int		realtime_prio			= 0;
+static int			raw_samples			= 0;
 static int			system_wide			= 0;
 static int			system_wide			= 0;
 static int			profile_cpu			= -1;
 static int			profile_cpu			= -1;
 static pid_t			target_pid			= -1;
 static pid_t			target_pid			= -1;
@@ -418,6 +419,8 @@ static void create_counter(int counter, int cpu, pid_t pid)
 	if (call_graph)
 	if (call_graph)
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
 
 
+	if (raw_samples)
+		attr->sample_type	|= PERF_SAMPLE_RAW;
 
 
 	attr->mmap		= track;
 	attr->mmap		= track;
 	attr->comm		= track;
 	attr->comm		= track;
@@ -650,6 +653,8 @@ static const struct option options[] = {
 		    "record events on existing pid"),
 		    "record events on existing pid"),
 	OPT_INTEGER('r', "realtime", &realtime_prio,
 	OPT_INTEGER('r', "realtime", &realtime_prio,
 		    "collect data with this RT SCHED_FIFO priority"),
 		    "collect data with this RT SCHED_FIFO priority"),
+	OPT_BOOLEAN('R', "raw-samples", &raw_samples,
+		    "collect raw sample records from all opened counters"),
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
 	OPT_BOOLEAN('a', "all-cpus", &system_wide,
 			    "system-wide collection from all CPUs"),
 			    "system-wide collection from all CPUs"),
 	OPT_BOOLEAN('A', "append", &append_file,
 	OPT_BOOLEAN('A', "append", &append_file,