aboutsummaryrefslogtreecommitdiff
path: root/tests/tracetool/simple.c
blob: 0484177481ce396485c3da239cc6046528136aa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* 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"

uint16_t _TRACE_TEST_BLAH_DSTATE;
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
TraceEvent _TRACE_TEST_BLAH_EVENT = {
    .id = 0,
    .name = "test_blah",
    .sstate = TRACE_TEST_BLAH_ENABLED,
    .dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
    .id = 0,
    .name = "test_wibble",
    .sstate = TRACE_TEST_WIBBLE_ENABLED,
    .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 "qemu/osdep.h"
#include "trace/control.h"
#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);
}