MINOR: trace: implement a very basic trace() function
For now it remains quite basic. It performs a few state checks, calls
the source's sink if defined, and performs the transitions between
RUNNING, STOPPED and WAITING when the configured events match.
diff --git a/include/proto/trace.h b/include/proto/trace.h
index 24d2601..6767952 100644
--- a/include/proto/trace.h
+++ b/include/proto/trace.h
@@ -34,6 +34,8 @@
extern struct list trace_sources;
extern THREAD_LOCAL struct buffer trace_buf;
+void __trace(uint64_t mask, struct trace_source *src, const struct ist msg);
+
/* return a single char to describe a trace state */
static inline char trace_state_char(enum trace_state st)
{
@@ -63,6 +65,13 @@
LIST_ADDQ(&trace_sources, &source->source_link);
}
+/* sends a trace for the given source */
+static inline void trace(uint64_t mask, struct trace_source *src, const struct ist msg)
+{
+ if (unlikely(src->state != TRACE_STATE_STOPPED))
+ __trace(mask, src, msg);
+}
+
#endif /* _PROTO_TRACE_H */
/*