The TraceEvent struct contains a "bool sstate" field which track whether a trace event was disabled statically. i.e. at build time via the "disable" property annotation in trace-events. The only runtime use of this field is to let "trace-event-get-state" report that an event is "unavailable" instead of reporting an error for an unknown trace event. Trace events are not ABI so their names can change and the event can come and go at any time. Thus there is little utility in reporting the existence of a disabled event that cannot ever be used at runtime. Removing the "bool sstate" field from TraceEvent saves 8 bytes of space in the struct, adding up to approx 64 KB across all current events. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20261102142844.3464712-24-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
/* This file is autogenerated by tracetool, do not edit. */
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "qemu/module.h"
|
|
#include "trace-testsuite.h"
|
|
|
|
uint8_t _TRACE_TEST_BLAH_DSTATE;
|
|
uint8_t _TRACE_TEST_WIBBLE_DSTATE;
|
|
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
|
#ifdef CONFIG_TRACE_SIMPLE
|
|
.id = 0,
|
|
#endif
|
|
.name = "test_blah",
|
|
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
|
};
|
|
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
|
#ifdef CONFIG_TRACE_SIMPLE
|
|
.id = 0,
|
|
#endif
|
|
.name = "test_wibble",
|
|
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
|
|
};
|
|
TraceEvent *testsuite_trace_events[] = {
|
|
&_TRACE_TEST_BLAH_EVENT,
|
|
&_TRACE_TEST_WIBBLE_EVENT,
|
|
NULL,
|
|
};
|
|
|
|
static void trace_testsuite_register_events(void)
|
|
{
|
|
trace_event_register_group(testsuite_trace_events);
|
|
}
|
|
trace_init(trace_testsuite_register_events)
|
|
#include "trace/simple.h"
|
|
|
|
void _simple_trace_test_blah(void *context, const char *filename)
|
|
{
|
|
TraceBufferRecord rec;
|
|
size_t argfilename_len = filename ? MIN(strlen(filename), MAX_TRACE_STRLEN) : 0;
|
|
|
|
if (trace_record_start(&rec, _TRACE_TEST_BLAH_EVENT.id, 8 + 4 + argfilename_len)) {
|
|
return; /* Trace Buffer Full, Event Dropped ! */
|
|
}
|
|
trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
|
|
trace_record_write_str(&rec, filename, argfilename_len);
|
|
trace_record_finish(&rec);
|
|
}
|
|
|
|
void _simple_trace_test_wibble(void *context, int value)
|
|
{
|
|
TraceBufferRecord rec;
|
|
|
|
if (trace_record_start(&rec, _TRACE_TEST_WIBBLE_EVENT.id, 8 + 8)) {
|
|
return; /* Trace Buffer Full, Event Dropped ! */
|
|
}
|
|
trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
|
|
trace_record_write_u64(&rec, (uint64_t)value);
|
|
trace_record_finish(&rec);
|
|
}
|
|
|