aboutsummaryrefslogtreecommitdiff
path: root/trace/control-internal.h
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2013-03-05 14:47:38 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-03-28 14:19:57 +0100
commitb1bae816c4c0743e37ee9e797a503610c34e3073 (patch)
tree4b10c9a3a0bfa301d8ecd728db20e61867eeb4ac /trace/control-internal.h
parent45be2f5d0dcdd314cd0c70a11220e5e09a44d654 (diff)
trace: Provide a detailed event control interface
This interface decouples event obtaining from interaction. Events can be obtained through three different methods: * identifier * name * simple wildcard pattern Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace/control-internal.h')
-rw-r--r--trace/control-internal.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/trace/control-internal.h b/trace/control-internal.h
new file mode 100644
index 0000000000..cce2da47c4
--- /dev/null
+++ b/trace/control-internal.h
@@ -0,0 +1,67 @@
+/*
+ * Interface for configuring and controlling the state of tracing events.
+ *
+ * Copyright (C) 2011-2012 Lluís Vilanova <vilanova@ac.upc.edu>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef TRACE__CONTROL_INTERNAL_H
+#define TRACE__CONTROL_INTERNAL_H
+
+#include <string.h>
+
+
+extern TraceEvent trace_events[];
+
+
+static inline TraceEvent *trace_event_id(TraceEventID id)
+{
+ assert(id < trace_event_count());
+ return &trace_events[id];
+}
+
+static inline TraceEventID trace_event_count(void)
+{
+ return TRACE_EVENT_COUNT;
+}
+
+static inline bool trace_event_is_pattern(const char *str)
+{
+ assert(str != NULL);
+ return strchr(str, '*') != NULL;
+}
+
+static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+{
+ assert(ev != NULL);
+ return ev->id;
+}
+
+static inline const char * trace_event_get_name(TraceEvent *ev)
+{
+ assert(ev != NULL);
+ return ev->name;
+}
+
+static inline bool trace_event_get_state_static(TraceEvent *ev)
+{
+ assert(ev != NULL);
+ return ev->sstate;
+}
+
+static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
+{
+ assert(ev != NULL);
+ return ev->dstate;
+}
+
+static inline void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+{
+ assert(ev != NULL);
+ assert(trace_event_get_state_static(ev));
+ return trace_event_set_state_dynamic_backend(ev, state);
+}
+
+#endif /* TRACE__CONTROL_INTERNAL_H */