18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci// Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
38c2ecf20Sopenharmony_ci#ifndef __PERF_EVSWITCH_H
48c2ecf20Sopenharmony_ci#define __PERF_EVSWITCH_H 1
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <stdbool.h>
78c2ecf20Sopenharmony_ci#include <stdio.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct evsel;
108c2ecf20Sopenharmony_cistruct evlist;
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct evswitch {
138c2ecf20Sopenharmony_ci	struct evsel *on, *off;
148c2ecf20Sopenharmony_ci	const char   *on_name, *off_name;
158c2ecf20Sopenharmony_ci	bool	     discarding;
168c2ecf20Sopenharmony_ci	bool	     show_on_off_events;
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciint evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cibool evswitch__discard(struct evswitch *evswitch, struct evsel *evsel);
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define OPTS_EVSWITCH(evswitch)								  \
248c2ecf20Sopenharmony_ci	OPT_STRING(0, "switch-on", &(evswitch)->on_name,				  \
258c2ecf20Sopenharmony_ci		   "event", "Consider events after the ocurrence of this event"),	  \
268c2ecf20Sopenharmony_ci	OPT_STRING(0, "switch-off", &(evswitch)->off_name,				  \
278c2ecf20Sopenharmony_ci		   "event", "Stop considering events after the ocurrence of this event"), \
288c2ecf20Sopenharmony_ci	OPT_BOOLEAN(0, "show-on-off-events", &(evswitch)->show_on_off_events,		  \
298c2ecf20Sopenharmony_ci		    "Show the on/off switch events, used with --switch-on and --switch-off")
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#endif /* __PERF_EVSWITCH_H */
32