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 <adrian.hunter@intel.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: William Cohen <wcohen@redhat.com>
Link: https://lkml.kernel.org/n/tip-v16pe3sbf3wjmn152u18f649@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0b495b12
...@@ -3543,12 +3543,7 @@ int cmd_script(int argc, const char **argv) ...@@ -3543,12 +3543,7 @@ int cmd_script(int argc, const char **argv)
"file", "file saving guest os /proc/kallsyms"), "file", "file saving guest os /proc/kallsyms"),
OPT_STRING(0, "guestmodules", &symbol_conf.default_guest_modules, OPT_STRING(0, "guestmodules", &symbol_conf.default_guest_modules,
"file", "file saving guest os /proc/modules"), "file", "file saving guest os /proc/modules"),
OPT_STRING(0, "switch-on", &script.evswitch.on_name, OPTS_EVSWITCH(&script.evswitch),
"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"),
OPT_END() OPT_END()
}; };
const char * const script_subcommands[] = { "record", "report", NULL }; const char * const script_subcommands[] = { "record", "report", NULL };
......
...@@ -16,4 +16,12 @@ struct evswitch { ...@@ -16,4 +16,12 @@ struct evswitch {
bool evswitch__discard(struct evswitch *evswitch, struct evsel *evsel); 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 */ #endif /* __PERF_EVSWITCH_H */
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