xref: /linux/tools/perf/util/tracepoint.h (revision 36ec807b627b4c0a0a382f0ae48eac7187d14b2b)
19b7c7728SIan Rogers /* SPDX-License-Identifier: GPL-2.0 */
29b7c7728SIan Rogers #ifndef __PERF_TRACEPOINT_H
39b7c7728SIan Rogers #define __PERF_TRACEPOINT_H
49b7c7728SIan Rogers 
59b7c7728SIan Rogers #include <dirent.h>
69b7c7728SIan Rogers #include <string.h>
7*d790ead8SIan Rogers #include <stdbool.h>
89b7c7728SIan Rogers 
99b7c7728SIan Rogers int tp_event_has_id(const char *dir_path, struct dirent *evt_dir);
109b7c7728SIan Rogers 
119b7c7728SIan Rogers #define for_each_event(dir_path, evt_dir, evt_dirent)		\
129b7c7728SIan Rogers 	while ((evt_dirent = readdir(evt_dir)) != NULL)		\
139b7c7728SIan Rogers 		if (evt_dirent->d_type == DT_DIR &&		\
149b7c7728SIan Rogers 		    (strcmp(evt_dirent->d_name, ".")) &&	\
159b7c7728SIan Rogers 		    (strcmp(evt_dirent->d_name, "..")) &&	\
169b7c7728SIan Rogers 		    (!tp_event_has_id(dir_path, evt_dirent)))
179b7c7728SIan Rogers 
189b7c7728SIan Rogers #define for_each_subsystem(sys_dir, sys_dirent)			\
199b7c7728SIan Rogers 	while ((sys_dirent = readdir(sys_dir)) != NULL)		\
209b7c7728SIan Rogers 		if (sys_dirent->d_type == DT_DIR &&		\
219b7c7728SIan Rogers 		    (strcmp(sys_dirent->d_name, ".")) &&	\
229b7c7728SIan Rogers 		    (strcmp(sys_dirent->d_name, "..")))
239b7c7728SIan Rogers 
24*d790ead8SIan Rogers bool is_valid_tracepoint(const char *event_string);
259b7c7728SIan Rogers 
269b7c7728SIan Rogers #endif /* __PERF_TRACEPOINT_H */
27