perf record: Move 'group' to perf_event_ops

Will be used in other tools to share the command line parsing code.

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-8x0yr77r6lrd2t699s499m8n@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b424eba2
...@@ -48,7 +48,6 @@ struct perf_record_opts record_opts = { ...@@ -48,7 +48,6 @@ struct perf_record_opts record_opts = {
static unsigned int page_size; static unsigned int page_size;
static int output; static int output;
static const char *output_name = NULL; static const char *output_name = NULL;
static bool group = false;
static int realtime_prio = 0; static int realtime_prio = 0;
static enum write_mode_t write_mode = WRITE_FORCE; static enum write_mode_t write_mode = WRITE_FORCE;
static bool no_buildid = false; static bool no_buildid = false;
...@@ -202,13 +201,13 @@ static void open_counters(struct perf_evlist *evlist) ...@@ -202,13 +201,13 @@ static void open_counters(struct perf_evlist *evlist)
*/ */
bool time_needed = attr->sample_type & PERF_SAMPLE_TIME; bool time_needed = attr->sample_type & PERF_SAMPLE_TIME;
if (group && pos != first) if (record_opts.group && pos != first)
group_fd = first->fd; group_fd = first->fd;
retry_sample_id: retry_sample_id:
attr->sample_id_all = record_opts.sample_id_all_avail ? 1 : 0; attr->sample_id_all = record_opts.sample_id_all_avail ? 1 : 0;
try_again: try_again:
if (perf_evsel__open(pos, evlist->cpus, evlist->threads, group, if (perf_evsel__open(pos, evlist->cpus, evlist->threads,
group_fd) < 0) { record_opts.group, group_fd) < 0) {
int err = errno; int err = errno;
if (err == EPERM || err == EACCES) { if (err == EPERM || err == EACCES) {
...@@ -649,7 +648,7 @@ const struct option record_options[] = { ...@@ -649,7 +648,7 @@ const struct option record_options[] = {
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", &record_opts.mmap_pages, OPT_UINTEGER('m', "mmap-pages", &record_opts.mmap_pages,
"number of mmap data pages"), "number of mmap data pages"),
OPT_BOOLEAN(0, "group", &group, OPT_BOOLEAN(0, "group", &record_opts.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,
"do call-graph (stack chain/backtrace) recording"), "do call-graph (stack chain/backtrace) recording"),
......
...@@ -189,6 +189,7 @@ struct perf_record_opts { ...@@ -189,6 +189,7 @@ struct perf_record_opts {
pid_t target_pid; pid_t target_pid;
pid_t target_tid; pid_t target_tid;
bool call_graph; bool call_graph;
bool group;
bool inherit_stat; bool inherit_stat;
bool no_delay; bool no_delay;
bool no_inherit; bool no_inherit;
......
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