xref: /OK3568_Linux_fs/kernel/tools/perf/util/evswitch.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun // Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
3*4882a593Smuzhiyun #ifndef __PERF_EVSWITCH_H
4*4882a593Smuzhiyun #define __PERF_EVSWITCH_H 1
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #include <stdbool.h>
7*4882a593Smuzhiyun #include <stdio.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun struct evsel;
10*4882a593Smuzhiyun struct evlist;
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun struct evswitch {
13*4882a593Smuzhiyun 	struct evsel *on, *off;
14*4882a593Smuzhiyun 	const char   *on_name, *off_name;
15*4882a593Smuzhiyun 	bool	     discarding;
16*4882a593Smuzhiyun 	bool	     show_on_off_events;
17*4882a593Smuzhiyun };
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun int evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun bool evswitch__discard(struct evswitch *evswitch, struct evsel *evsel);
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #define OPTS_EVSWITCH(evswitch)								  \
24*4882a593Smuzhiyun 	OPT_STRING(0, "switch-on", &(evswitch)->on_name,				  \
25*4882a593Smuzhiyun 		   "event", "Consider events after the ocurrence of this event"),	  \
26*4882a593Smuzhiyun 	OPT_STRING(0, "switch-off", &(evswitch)->off_name,				  \
27*4882a593Smuzhiyun 		   "event", "Stop considering events after the ocurrence of this event"), \
28*4882a593Smuzhiyun 	OPT_BOOLEAN(0, "show-on-off-events", &(evswitch)->show_on_off_events,		  \
29*4882a593Smuzhiyun 		    "Show the on/off switch events, used with --switch-on and --switch-off")
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #endif /* __PERF_EVSWITCH_H */
32