linux-stable/tools/perf/util/tracepoint.h
Ian Rogers 9b7c7728f4 perf parse-events: Break out tracepoint and printing
Move print_*_events functions out of parse-events.c into a new
print-events.c. Move tracepoint code into tracepoint.c or
trace-event-info.c (sole user). This reduces the dependencies of
parse-events.c and makes it more amenable to being a library in the
future.

Remove some unnecessary definitions from parse-events.h. Fix a
checkpatch.pl warning on using unsigned rather than unsigned int.  Fix
some line length warnings too.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220729204217.250166-3-irogers@google.com
[ Add include linux/stddef.h before perf_events.h for systems where __always_inline isn't pulled in before used, such as older Alpine Linux ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-08-02 16:32:26 -03:00

25 lines
813 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __PERF_TRACEPOINT_H
#define __PERF_TRACEPOINT_H
#include <dirent.h>
#include <string.h>
int tp_event_has_id(const char *dir_path, struct dirent *evt_dir);
#define for_each_event(dir_path, evt_dir, evt_dirent) \
while ((evt_dirent = readdir(evt_dir)) != NULL) \
if (evt_dirent->d_type == DT_DIR && \
(strcmp(evt_dirent->d_name, ".")) && \
(strcmp(evt_dirent->d_name, "..")) && \
(!tp_event_has_id(dir_path, evt_dirent)))
#define for_each_subsystem(sys_dir, sys_dirent) \
while ((sys_dirent = readdir(sys_dir)) != NULL) \
if (sys_dirent->d_type == DT_DIR && \
(strcmp(sys_dirent->d_name, ".")) && \
(strcmp(sys_dirent->d_name, "..")))
int is_valid_tracepoint(const char *event_string);
#endif /* __PERF_TRACEPOINT_H */