@@ -19,11 +19,13 @@ static inline bool trace_event_is_pattern(const char *str)
return strchr(str, '*') != NULL;
}
+#ifdef CONFIG_TRACE_SIMPLE
static inline uint32_t trace_event_get_id(TraceEvent *ev)
{
assert(ev != NULL);
return ev->id;
}
+#endif
static inline const char * trace_event_get_name(TraceEvent *ev)
{
@@ -81,13 +81,14 @@ TraceEvent *trace_event_name(const char *name);
*/
static bool trace_event_is_pattern(const char *str);
-
+#ifdef CONFIG_TRACE_SIMPLE
/**
* trace_event_get_id:
*
* Get the identifier of an event.
*/
static uint32_t trace_event_get_id(TraceEvent *ev);
+#endif
/**
* trace_event_get_name:
@@ -20,7 +20,9 @@
* Opaque generic description of a tracing event.
*/
typedef struct TraceEvent {
+#ifdef CONFIG_TRACE_SIMPLE
uint32_t id;
+#endif
const char * name;
const bool sstate;
uint16_t *dstate;
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -8,13 +8,17 @@
uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_blah",
.sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
.id = 0,
+#endif
.name = "test_wibble",
.sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
@@ -36,8 +36,8 @@ typedef struct TraceEventGroup {
static TraceEventGroup *event_groups;
static size_t nevent_groups;
-static uint32_t next_id;
#ifdef CONFIG_TRACE_SIMPLE
+static uint32_t next_id;
static bool init_trace_on_startup;
#endif
static char *trace_opts_file;
@@ -65,10 +65,12 @@ QemuOptsList qemu_trace_opts = {
void trace_event_register_group(TraceEvent **events)
{
+#ifdef CONFIG_TRACE_SIMPLE
size_t i;
for (i = 0; events[i] != NULL; i++) {
events[i]->id = next_id++;
}
+#endif
event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
event_groups[nevent_groups].events = events;
nevent_groups++;
@@ -34,7 +34,9 @@ def generate(events, backend, group):
for e in events:
out('TraceEvent %(event)s = {',
+ '#ifdef CONFIG_TRACE_SIMPLE',
' .id = 0,',
+ '#endif',
' .name = \"%(name)s\",',
' .sstate = %(sstate)s,',
' .dstate = &%(dstate)s',