162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci// Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
362306a36Sopenharmony_ci#ifndef __PERF_EVSWITCH_H
462306a36Sopenharmony_ci#define __PERF_EVSWITCH_H 1
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include <stdbool.h>
762306a36Sopenharmony_ci#include <stdio.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct evsel;
1062306a36Sopenharmony_cistruct evlist;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct evswitch {
1362306a36Sopenharmony_ci	struct evsel *on, *off;
1462306a36Sopenharmony_ci	const char   *on_name, *off_name;
1562306a36Sopenharmony_ci	bool	     discarding;
1662306a36Sopenharmony_ci	bool	     show_on_off_events;
1762306a36Sopenharmony_ci};
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciint evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cibool evswitch__discard(struct evswitch *evswitch, struct evsel *evsel);
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define OPTS_EVSWITCH(evswitch)								  \
2462306a36Sopenharmony_ci	OPT_STRING(0, "switch-on", &(evswitch)->on_name,				  \
2562306a36Sopenharmony_ci		   "event", "Consider events after the occurrence of this event"),	  \
2662306a36Sopenharmony_ci	OPT_STRING(0, "switch-off", &(evswitch)->off_name,				  \
2762306a36Sopenharmony_ci		   "event", "Stop considering events after the occurrence of this event"), \
2862306a36Sopenharmony_ci	OPT_BOOLEAN(0, "show-on-off-events", &(evswitch)->show_on_off_events,		  \
2962306a36Sopenharmony_ci		    "Show the on/off switch events, used with --switch-on and --switch-off")
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#endif /* __PERF_EVSWITCH_H */
32