perf record: Move mmap_pages to perf_record_opts

Tools being developed will need this to allow the user to override this
value.

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-zydc1yhxfm0z35fuy95bsn1l@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 50a682ce
...@@ -35,9 +35,10 @@ enum write_mode_t { ...@@ -35,9 +35,10 @@ enum write_mode_t {
WRITE_APPEND WRITE_APPEND
}; };
static struct perf_record_opts record_opts = { struct perf_record_opts record_opts = {
.target_pid = -1, .target_pid = -1,
.target_tid = -1, .target_tid = -1,
.mmap_pages = UINT_MAX,
.user_freq = UINT_MAX, .user_freq = UINT_MAX,
.user_interval = ULLONG_MAX, .user_interval = ULLONG_MAX,
.freq = 1000, .freq = 1000,
...@@ -45,7 +46,6 @@ static struct perf_record_opts record_opts = { ...@@ -45,7 +46,6 @@ static struct perf_record_opts record_opts = {
}; };
static unsigned int page_size; static unsigned int page_size;
static unsigned int mmap_pages = UINT_MAX;
static int output; static int output;
static const char *output_name = NULL; static const char *output_name = NULL;
static bool group = false; static bool group = false;
...@@ -272,7 +272,7 @@ static void open_counters(struct perf_evlist *evlist) ...@@ -272,7 +272,7 @@ static void open_counters(struct perf_evlist *evlist)
exit(-1); exit(-1);
} }
if (perf_evlist__mmap(evlist, mmap_pages, false) < 0) if (perf_evlist__mmap(evlist, record_opts.mmap_pages, false) < 0)
die("failed to mmap with %d (%s)\n", errno, strerror(errno)); die("failed to mmap with %d (%s)\n", errno, strerror(errno));
if (file_new) if (file_new)
...@@ -647,7 +647,8 @@ const struct option record_options[] = { ...@@ -647,7 +647,8 @@ const struct option record_options[] = {
OPT_BOOLEAN('i', "no-inherit", &record_opts.no_inherit, OPT_BOOLEAN('i', "no-inherit", &record_opts.no_inherit,
"child tasks do not inherit counters"), "child tasks do not inherit counters"),
OPT_UINTEGER('F', "freq", &record_opts.user_freq, "profile at this frequency"), OPT_UINTEGER('F', "freq", &record_opts.user_freq, "profile at this frequency"),
OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"), OPT_UINTEGER('m', "mmap-pages", &record_opts.mmap_pages,
"number of mmap data pages"),
OPT_BOOLEAN(0, "group", &group, OPT_BOOLEAN(0, "group", &group,
"put the counters into a counter group"), "put the counters into a counter group"),
OPT_BOOLEAN('g', "call-graph", &record_opts.call_graph, OPT_BOOLEAN('g', "call-graph", &record_opts.call_graph,
......
...@@ -200,6 +200,7 @@ struct perf_record_opts { ...@@ -200,6 +200,7 @@ struct perf_record_opts {
bool sample_id_all_avail; bool sample_id_all_avail;
bool system_wide; bool system_wide;
unsigned int freq; unsigned int freq;
unsigned int mmap_pages;
unsigned int user_freq; unsigned int user_freq;
u64 default_interval; u64 default_interval;
u64 user_interval; u64 user_interval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment