xref: /openbmc/linux/tools/perf/util/tracepoint.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*9b7c7728SIan Rogers /* SPDX-License-Identifier: GPL-2.0 */
2*9b7c7728SIan Rogers #ifndef __PERF_TRACEPOINT_H
3*9b7c7728SIan Rogers #define __PERF_TRACEPOINT_H
4*9b7c7728SIan Rogers 
5*9b7c7728SIan Rogers #include <dirent.h>
6*9b7c7728SIan Rogers #include <string.h>
7*9b7c7728SIan Rogers 
8*9b7c7728SIan Rogers int tp_event_has_id(const char *dir_path, struct dirent *evt_dir);
9*9b7c7728SIan Rogers 
10*9b7c7728SIan Rogers #define for_each_event(dir_path, evt_dir, evt_dirent)		\
11*9b7c7728SIan Rogers 	while ((evt_dirent = readdir(evt_dir)) != NULL)		\
12*9b7c7728SIan Rogers 		if (evt_dirent->d_type == DT_DIR &&		\
13*9b7c7728SIan Rogers 		    (strcmp(evt_dirent->d_name, ".")) &&	\
14*9b7c7728SIan Rogers 		    (strcmp(evt_dirent->d_name, "..")) &&	\
15*9b7c7728SIan Rogers 		    (!tp_event_has_id(dir_path, evt_dirent)))
16*9b7c7728SIan Rogers 
17*9b7c7728SIan Rogers #define for_each_subsystem(sys_dir, sys_dirent)			\
18*9b7c7728SIan Rogers 	while ((sys_dirent = readdir(sys_dir)) != NULL)		\
19*9b7c7728SIan Rogers 		if (sys_dirent->d_type == DT_DIR &&		\
20*9b7c7728SIan Rogers 		    (strcmp(sys_dirent->d_name, ".")) &&	\
21*9b7c7728SIan Rogers 		    (strcmp(sys_dirent->d_name, "..")))
22*9b7c7728SIan Rogers 
23*9b7c7728SIan Rogers int is_valid_tracepoint(const char *event_string);
24*9b7c7728SIan Rogers 
25*9b7c7728SIan Rogers #endif /* __PERF_TRACEPOINT_H */
26