diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-02-14 11:18:57 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-02-14 11:18:57 -0500 |
commit | 808e122630d45a7f036d25582474d70548a87e2c (patch) | |
tree | 96a8d45358110ce48f184d2a62f7816022ff5c1a /tools/perf/builtin-record.c | |
parent | 0c9781280fb672ca09c997df3f14ba506bbdb977 (diff) |
perf tools: Invert the sample_id_all logic
Instead of requiring that users of perf_record_opts set
.sample_id_all_avail to true, just invert the logic, using
.sample_id_all_missing, that doesn't need to be explicitely initialized
since gcc will zero members ommitted in a struct initialization.
Just like the newly introduced .exclude_{guest,host} feature test.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ab772uzk78cwybihf0vt7kxw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d6c10e8ff6b6..75d230fef202 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -209,7 +209,7 @@ fallback_missing_features: | |||
209 | if (opts->exclude_guest_missing) | 209 | if (opts->exclude_guest_missing) |
210 | attr->exclude_guest = attr->exclude_host = 0; | 210 | attr->exclude_guest = attr->exclude_host = 0; |
211 | retry_sample_id: | 211 | retry_sample_id: |
212 | attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; | 212 | attr->sample_id_all = opts->sample_id_all_missing ? 0 : 1; |
213 | try_again: | 213 | try_again: |
214 | if (perf_evsel__open(pos, evlist->cpus, evlist->threads, | 214 | if (perf_evsel__open(pos, evlist->cpus, evlist->threads, |
215 | opts->group, group_fd) < 0) { | 215 | opts->group, group_fd) < 0) { |
@@ -228,11 +228,11 @@ try_again: | |||
228 | "guest or host samples.\n"); | 228 | "guest or host samples.\n"); |
229 | opts->exclude_guest_missing = true; | 229 | opts->exclude_guest_missing = true; |
230 | goto fallback_missing_features; | 230 | goto fallback_missing_features; |
231 | } else if (opts->sample_id_all_avail) { | 231 | } else if (!opts->sample_id_all_missing) { |
232 | /* | 232 | /* |
233 | * Old kernel, no attr->sample_id_type_all field | 233 | * Old kernel, no attr->sample_id_type_all field |
234 | */ | 234 | */ |
235 | opts->sample_id_all_avail = false; | 235 | opts->sample_id_all_missing = true; |
236 | if (!opts->sample_time && !opts->raw_samples && !time_needed) | 236 | if (!opts->sample_time && !opts->raw_samples && !time_needed) |
237 | attr->sample_type &= ~PERF_SAMPLE_TIME; | 237 | attr->sample_type &= ~PERF_SAMPLE_TIME; |
238 | 238 | ||
@@ -660,7 +660,6 @@ static struct perf_record record = { | |||
660 | .user_freq = UINT_MAX, | 660 | .user_freq = UINT_MAX, |
661 | .user_interval = ULLONG_MAX, | 661 | .user_interval = ULLONG_MAX, |
662 | .freq = 1000, | 662 | .freq = 1000, |
663 | .sample_id_all_avail = true, | ||
664 | }, | 663 | }, |
665 | .write_mode = WRITE_FORCE, | 664 | .write_mode = WRITE_FORCE, |
666 | .file_new = true, | 665 | .file_new = true, |