aboutsummaryrefslogtreecommitdiff
path: root/trace/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace/control.c')
-rw-r--r--trace/control.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/trace/control.c b/trace/control.c
index 10b3e9baba..5a9bb5a8c7 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -125,6 +125,27 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
return NULL;
}
+void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
+{
+ iter->event = 0;
+ iter->pattern = pattern;
+}
+
+TraceEvent *trace_event_iter_next(TraceEventIter *iter)
+{
+ while (iter->event < TRACE_EVENT_COUNT) {
+ TraceEvent *ev = &(trace_events[iter->event]);
+ iter->event++;
+ if (!iter->pattern ||
+ pattern_glob(iter->pattern,
+ trace_event_get_name(ev))) {
+ return ev;
+ }
+ }
+
+ return NULL;
+}
+
void trace_list_events(void)
{
int i;