diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-09-01 06:36:12 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-09 10:24:10 -0400 |
commit | 994a1f78b191df0c9d6caca3f3afb03e247aff26 (patch) | |
tree | 387ca6391f946bbbca73a579105ee0bc2ba76ad8 /tools/perf/builtin-record.c | |
parent | f37376cd721a539ac398cbb7718b72fce83cd49b (diff) |
perf tools: Check mmap pages value early
Move the check of the mmap_pages value to the options parsing time, so
we could rely on this value on other parts of code.
Related changes come in the next patches.
Also changes perf_evlist::mmap_len to proper size_t type.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1378031796-17892-2-git-send-email-jolsa@redhat.com
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 | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0aacd6295fe6..92ca5419073b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -233,10 +233,6 @@ try_again: | |||
233 | "or try again with a smaller value of -m/--mmap_pages.\n" | 233 | "or try again with a smaller value of -m/--mmap_pages.\n" |
234 | "(current value: %d)\n", opts->mmap_pages); | 234 | "(current value: %d)\n", opts->mmap_pages); |
235 | rc = -errno; | 235 | rc = -errno; |
236 | } else if (!is_power_of_2(opts->mmap_pages) && | ||
237 | (opts->mmap_pages != UINT_MAX)) { | ||
238 | pr_err("--mmap_pages/-m value must be a power of two."); | ||
239 | rc = -EINVAL; | ||
240 | } else { | 236 | } else { |
241 | pr_err("failed to mmap with %d (%s)\n", errno, strerror(errno)); | 237 | pr_err("failed to mmap with %d (%s)\n", errno, strerror(errno)); |
242 | rc = -errno; | 238 | rc = -errno; |
@@ -854,8 +850,9 @@ const struct option record_options[] = { | |||
854 | OPT_BOOLEAN('i', "no-inherit", &record.opts.no_inherit, | 850 | OPT_BOOLEAN('i', "no-inherit", &record.opts.no_inherit, |
855 | "child tasks do not inherit counters"), | 851 | "child tasks do not inherit counters"), |
856 | OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"), | 852 | OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"), |
857 | OPT_UINTEGER('m', "mmap-pages", &record.opts.mmap_pages, | 853 | OPT_CALLBACK('m', "mmap-pages", &record.opts.mmap_pages, "pages", |
858 | "number of mmap data pages"), | 854 | "number of mmap data pages", |
855 | perf_evlist__parse_mmap_pages), | ||
859 | OPT_BOOLEAN(0, "group", &record.opts.group, | 856 | OPT_BOOLEAN(0, "group", &record.opts.group, |
860 | "put the counters into a counter group"), | 857 | "put the counters into a counter group"), |
861 | OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, | 858 | OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, |