From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965332AbcJXRDj (ORCPT ); Mon, 24 Oct 2016 13:03:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52382 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933734AbcJXRDg (ORCPT ); Mon, 24 Oct 2016 13:03:36 -0400 Date: Mon, 24 Oct 2016 19:03:32 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen , Wang Nan , Josh Poimboeuf Subject: Re: [RFC/PATCH 2/2] perf sched: Make common options cascading Message-ID: <20161024170332.GE31643@krava> References: <20161024030003.28534-1-namhyung@kernel.org> <20161024030003.28534-2-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161024030003.28534-2-namhyung@kernel.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 24 Oct 2016 17:03:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 24, 2016 at 12:00:03PM +0900, Namhyung Kim wrote: > The -i and -v options can be used in subcommands so enable cascading the > sched_options. This fixes the following inconvenience in 'perf sched': > > $ perf sched -i perf.data.sched map > ... (it works well) ... > > $ perf sched map -i perf.data.sched > Error: unknown switch `i' > > Usage: perf sched map [] > > --color-cpus > highlight given CPUs in map > --color-pids > highlight given pids in map > --compact map output in compact mode > --cpus display given CPUs in map > > With this patch, the second command line works with the perf.data.sched > data file. > > Cc: Josh Poimboeuf > Signed-off-by: Namhyung Kim good idea, I'll use it in c2c ;-) for both: Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/builtin-sched.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c > index f5503ca22e1c..8ca1b5409289 100644 > --- a/tools/perf/builtin-sched.c > +++ b/tools/perf/builtin-sched.c > @@ -1954,6 +1954,15 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) > .next_shortname2 = '0', > .skip_merge = 0, > }; > + const struct option sched_options[] = { > + OPT_STRING('i', "input", &input_name, "file", > + "input file name"), > + OPT_INCR('v', "verbose", &verbose, > + "be more verbose (show symbol address, etc)"), > + OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, > + "dump raw trace in ASCII"), > + OPT_END() > + }; > const struct option latency_options[] = { > OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]", > "sort by key(s): runtime, switch, avg, max"), > @@ -1965,7 +1974,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) > "dump raw trace in ASCII"), > OPT_BOOLEAN('p', "pids", &sched.skip_merge, > "latency stats per pid instead of per comm"), > - OPT_END() > + OPT_PARENT(sched_options) > }; > const struct option replay_options[] = { > OPT_UINTEGER('r', "repeat", &sched.replay_repeat, > @@ -1975,16 +1984,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) > OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, > "dump raw trace in ASCII"), > OPT_BOOLEAN('f', "force", &sched.force, "don't complain, do it"), > - OPT_END() > - }; > - const struct option sched_options[] = { > - OPT_STRING('i', "input", &input_name, "file", > - "input file name"), > - OPT_INCR('v', "verbose", &verbose, > - "be more verbose (show symbol address, etc)"), > - OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, > - "dump raw trace in ASCII"), > - OPT_END() > + OPT_PARENT(sched_options) > }; > const struct option map_options[] = { > OPT_BOOLEAN(0, "compact", &sched.map.comp, > @@ -1995,7 +1995,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) > "highlight given CPUs in map"), > OPT_STRING(0, "cpus", &sched.map.cpus_str, "cpus", > "display given CPUs in map"), > - OPT_END() > + OPT_PARENT(sched_options) > }; > const char * const latency_usage[] = { > "perf sched latency []", > -- > 2.10.0 >