xref: /qemu/trace-events (revision 6d519a5f95960176039baf0af8799fa289915534)
194a420b1SStefan Hajnoczi# Trace events for debugging and performance instrumentation
294a420b1SStefan Hajnoczi#
394a420b1SStefan Hajnoczi# This file is processed by the tracetool script during the build.
494a420b1SStefan Hajnoczi#
594a420b1SStefan Hajnoczi# To add a new trace event:
694a420b1SStefan Hajnoczi#
794a420b1SStefan Hajnoczi# 1. Choose a name for the trace event.  Declare its arguments and format
894a420b1SStefan Hajnoczi#    string.
994a420b1SStefan Hajnoczi#
1094a420b1SStefan Hajnoczi# 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
1194a420b1SStefan Hajnoczi#    trace_multiwrite_cb().  The source file must #include "trace.h".
1294a420b1SStefan Hajnoczi#
1394a420b1SStefan Hajnoczi# Format of a trace event:
1494a420b1SStefan Hajnoczi#
151e2cf2bcSStefan Hajnoczi# [disable] <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
1694a420b1SStefan Hajnoczi#
1794a420b1SStefan Hajnoczi# Example: qemu_malloc(size_t size) "size %zu"
1894a420b1SStefan Hajnoczi#
191e2cf2bcSStefan Hajnoczi# The "disable" keyword will build without the trace event.
201e2cf2bcSStefan Hajnoczi# In case of 'simple' trace backend, it will allow the trace event to be
211e2cf2bcSStefan Hajnoczi# compiled, but this would be turned off by default. It can be toggled on via
221e2cf2bcSStefan Hajnoczi# the monitor.
231e2cf2bcSStefan Hajnoczi#
2494a420b1SStefan Hajnoczi# The <name> must be a valid as a C function name.
2594a420b1SStefan Hajnoczi#
2694a420b1SStefan Hajnoczi# Types should be standard C types.  Use void * for pointers because the trace
2794a420b1SStefan Hajnoczi# system may not have the necessary headers included.
2894a420b1SStefan Hajnoczi#
2994a420b1SStefan Hajnoczi# The <format-string> should be a sprintf()-compatible format string.
30cd245a19SStefan Hajnoczi
31cd245a19SStefan Hajnoczi# qemu-malloc.c
32cd245a19SStefan Hajnoczidisable qemu_malloc(size_t size, void *ptr) "size %zu ptr %p"
33cd245a19SStefan Hajnoczidisable qemu_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
34cd245a19SStefan Hajnoczidisable qemu_free(void *ptr) "ptr %p"
35cd245a19SStefan Hajnoczi
36cd245a19SStefan Hajnoczi# osdep.c
37cd245a19SStefan Hajnoczidisable qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
38cd245a19SStefan Hajnoczidisable qemu_valloc(size_t size, void *ptr) "size %zu ptr %p"
39cd245a19SStefan Hajnoczidisable qemu_vfree(void *ptr) "ptr %p"
40*6d519a5fSStefan Hajnoczi
41*6d519a5fSStefan Hajnoczi# block.c
42*6d519a5fSStefan Hajnoczidisable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
43*6d519a5fSStefan Hajnoczidisable bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"
44*6d519a5fSStefan Hajnoczidisable bdrv_aio_multiwrite_earlyfail(void *mcb) "mcb %p"
45*6d519a5fSStefan Hajnoczidisable bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
46*6d519a5fSStefan Hajnoczi
47*6d519a5fSStefan Hajnoczi# hw/virtio-blk.c
48*6d519a5fSStefan Hajnoczidisable virtio_blk_req_complete(void *req, int status) "req %p status %d"
49*6d519a5fSStefan Hajnoczidisable virtio_blk_rw_complete(void *req, int ret) "req %p ret %d"
50*6d519a5fSStefan Hajnoczidisable virtio_blk_handle_write(void *req, unsigned long sector, unsigned long nsectors) "req %p sector %lu nsectors %lu"
51*6d519a5fSStefan Hajnoczi
52*6d519a5fSStefan Hajnoczi# posix-aio-compat.c
53*6d519a5fSStefan Hajnoczidisable paio_submit(void *acb, void *opaque, unsigned long sector_num, unsigned long nb_sectors, unsigned long type) "acb %p opaque %p sector_num %lu nb_sectors %lu type %lu"
54