Skip to content

Commit

Permalink
perf tools: Record events info also when :record suffix is used.
Browse files Browse the repository at this point in the history
You can enable a counter's PERF_SAMPLE_RAW attribute in two
fashions:

- using the -R option (every counters get PERF_SAMPLE_RAW)
- using the :record suffix in a trace event counter name

Currently we record the events info in a trace.info file from
perf record when the former method is used but we omit it with
the latter.

Check both situations.

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>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1250543271-8383-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Aug 17, 2009
1 parent 4bf2364 commit 9df37dd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,6 @@ static int __cmd_record(int argc, const char **argv)
signal(SIGCHLD, sig_handler);
signal(SIGINT, sig_handler);

if (raw_samples)
read_tracing_data();

if (!stat(output_name, &st) && st.st_size) {
if (!force && !append_file) {
fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n",
Expand Down Expand Up @@ -550,6 +547,17 @@ static int __cmd_record(int argc, const char **argv)
else
header = perf_header__new();


if (raw_samples) {
read_tracing_data();
} else {
for (i = 0; i < nr_counters; i++) {
if (attrs[i].sample_type & PERF_SAMPLE_RAW) {
read_tracing_data();
break;
}
}
}
atexit(atexit_header);

if (!system_wide) {
Expand Down

0 comments on commit 9df37dd

Please sign in to comment.