perf evswitch: Introduce OPTS_EVSWITCH() for cmd line processing
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: add3a719c95f0443d563889b4af255b78ba54521 Gitweb: https://git.kernel.org/tip/add3a719c95f0443d563889b4af255b78ba54521 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Thu, 15 Aug 2019 11:21:21 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 15 Aug 2019 12:25:47 -0300
perf evswitch: Introduce OPTS_EVSWITCH() for cmd line processing
All tools will want those, so provide a convenient way to get them.
Cc Adrian Hunter <[email protected]>
Cc Florian Weimer <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc William Cohen <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-script.c | 7 +------ tools/perf/util/evswitch.h | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-)
tools/perf/builtin-script.c +1 -6
@@ -3543,12 +3543,7 @@ int cmd_script(int argc, const char **argv) "file", "file saving guest os /proc/kallsyms"),OPT_STRING (0 ,"guestmodules" , &symbol_conf.default_guest_modules,"file" ,"file saving guest os /proc/modules" ), -OPT_STRING (0 ,"switch-on" , &script.evswitch.on_name, -"event" ,"Consider events after the ocurrence of this event" ), -OPT_STRING (0 ,"switch-off" , &script.evswitch.off_name, -"event" ,"Stop considering events after the ocurrence of this event" ), -OPT_BOOLEAN (0 ,"show-on-off-events" , &script.evswitch.show_on_off_events, -"Show the on/off switch events, used with --switch-on" ), +OPTS_EVSWITCH (&script.evswitch), OPT_END() };const char *const script_subcommands[] = {"record" ,"report" ,NULL };
tools/perf/util/evswitch.h +8 -0
@@ -16,4 +16,12 @@ struct evswitch {bool evswitch__discard (struct evswitch *evswitch,struct evsel *evsel); +#define OPTS_EVSWITCH (evswitch) \ + OPT_STRING(0, "switch-on", &(evswitch)->on_name, \ + "event", "Consider events after the ocurrence of this event"), \ + OPT_STRING(0, "switch-off", &(evswitch)->off_name, \ + "event", "Stop considering events after the ocurrence of this event"), \ + OPT_BOOLEAN(0, "show-on-off-events", &(evswitch)->show_on_off_events, \ + "Show the on/off switch events, used with --switch-on and --switch-off") +#endif /* __PERF_EVSWITCH_H */