xref: /qemu/trace-events (revision cf83f140059f21d4629ae4b61d468c3baef2bb4c)
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#
17a74cd8ccSFrediano Ziglio# Example: g_malloc(size_t size) "size %zu"
1894a420b1SStefan Hajnoczi#
191e2cf2bcSStefan Hajnoczi# The "disable" keyword will build without the trace event.
201e2cf2bcSStefan Hajnoczi#
2194a420b1SStefan Hajnoczi# The <name> must be a valid as a C function name.
2294a420b1SStefan Hajnoczi#
2394a420b1SStefan Hajnoczi# Types should be standard C types.  Use void * for pointers because the trace
2494a420b1SStefan Hajnoczi# system may not have the necessary headers included.
2594a420b1SStefan Hajnoczi#
2694a420b1SStefan Hajnoczi# The <format-string> should be a sprintf()-compatible format string.
27cd245a19SStefan Hajnoczi
28bd3c9aa5SPrerna Saxena# ioport.c
296f94b7d9SPaolo Bonzinicpu_in(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
306f94b7d9SPaolo Bonzinicpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
3162dd89deSPrerna Saxena
3262dd89deSPrerna Saxena# balloon.c
3362dd89deSPrerna Saxena# Since requests are raised via monitor, not many tracepoints are needed.
3447f08d7aSLluísballoon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
35d8023f31SBlue Swirl
3694b0b5ffSStefan Hajnoczi# vl.c
3747f08d7aSLluísvm_state_notify(int running, int reason) "running %d reason %d"
384524051cSGerd Hoffmannload_file(const char *name, const char *path) "name %s location %s"
397e866003SKazuya Saitorunstate_set(int new_state) "new state %d"
404fed9421SAlexey Kardashevskiysystem_wakeup_request(int reason) "reason=%d"
41*cf83f140SEric Blakeqemu_system_shutdown_request(int reason) "reason=%d"
42bc78cff9SYang Zhiyongqemu_system_powerdown_request(void) ""
43298800caSStefan Hajnoczi
44cbcc6336SAlon Levy# spice-qemu-char.c
457de42283SMarc-André Lureauspice_vmc_write(ssize_t out, int len) "spice wrote %zd of requested %d"
4647f08d7aSLluísspice_vmc_read(int bytes, int len) "spice read %d of requested %d"
4747f08d7aSLluísspice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
4847f08d7aSLluísspice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
495a49d3e9SMarc-André Lureauspice_vmc_event(int event) "spice vmc event %d"
504ef66fa7SMichael Walle
5189bd820aSStefan Hajnoczi# monitor.c
5293f8f982SMarkus Armbrustermonitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
53afeecec2SDaniel P. Berrangemonitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
5493f8f982SMarkus Armbrustermonitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64
55342407fdSMax Filippov
56c57c4658SKevin Wolf# dma-helpers.c
57cbe0ed62SPaolo Bonzinidma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"
58c57c4658SKevin Wolfdma_aio_cancel(void *dbs) "dbs=%p"
59c57c4658SKevin Wolfdma_complete(void *dbs, int ret, void *cb) "dbs=%p ret=%d cb=%p"
604be74634SMarkus Armbrusterdma_blk_cb(void *dbs, int ret) "dbs=%p ret=%d"
61c57c4658SKevin Wolfdma_map_wait(void *dbs) "dbs=%p"
62cdbc19ddSAlon Levy
639c775729SKazuya Saito# kvm-all.c
644fe6e9ecSAlexey Kardashevskiykvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
654fe6e9ecSAlexey Kardashevskiykvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
664fe6e9ecSAlexey Kardashevskiykvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
67b76ac80aSKazuya Saitokvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
680a6a7ccaSChristoffer Dallkvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
69ada4135fSCornelia Huckkvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
70ada4135fSCornelia Huckkvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
7154a6c11bSPeter Xukvm_irqchip_commit_routes(void) ""
7254a6c11bSPeter Xukvm_irqchip_add_msi_route(int virq) "Adding MSI route virq=%d"
7354a6c11bSPeter Xukvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
74b76ac80aSKazuya Saito
756db8b538SAlex Bennée# TCG related tracing (mostly disabled by default)
766db8b538SAlex Bennée# cpu-exec.c
776db8b538SAlex Bennéedisable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
786db8b538SAlex Bennéedisable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
79819af24bSSergey Fedorovdisable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"
806db8b538SAlex Bennée
816db8b538SAlex Bennée# translate-all.c
826db8b538SAlex Bennéetranslate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
836db8b538SAlex Bennée
8455d5d048SPaolo Bonzini# memory.c
855a68be94SHollis Blanchardmemory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
865a68be94SHollis Blanchardmemory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
875a68be94SHollis Blanchardmemory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset %#"PRIx64" value %#"PRIx64" size %u"
885a68be94SHollis Blanchardmemory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset %#"PRIx64" value %#"PRIx64" size %u"
89f2d08942SHollis Blanchardmemory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
90f2d08942SHollis Blanchardmemory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
914a2e242bSAlex Williamsonmemory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
924a2e242bSAlex Williamsonmemory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
9355d5d048SPaolo Bonzini
94dcdaadb6SLluís Vilanova### Guest events, keep at bottom
95dcdaadb6SLluís Vilanova
96b9d72215SLluís Vilanova
97b9d72215SLluís Vilanova## vCPU
98b9d72215SLluís Vilanova
99b9d72215SLluís Vilanova# Hot-plug a new virtual (guest) CPU
100b9d72215SLluís Vilanova#
101f5e2b3beSLluís Vilanova# Mode: user, softmmu
102b9d72215SLluís Vilanova# Targets: all
103b9d72215SLluís Vilanovavcpu guest_cpu_enter(void)
104b9d72215SLluís Vilanova
105a47e8715SLluís Vilanova# Hot-unplug a virtual (guest) CPU
106a47e8715SLluís Vilanova#
107a47e8715SLluís Vilanova# Mode: user, softmmu
108a47e8715SLluís Vilanova# Targets: all
109a47e8715SLluís Vilanovavcpu guest_cpu_exit(void)
110a47e8715SLluís Vilanova
1112cc2d082SLluís Vilanova# Reset the state of a virtual (guest) CPU
1122cc2d082SLluís Vilanova#
113f5e2b3beSLluís Vilanova# Mode: user, softmmu
1142cc2d082SLluís Vilanova# Targets: all
1152cc2d082SLluís Vilanovavcpu guest_cpu_reset(void)
1162cc2d082SLluís Vilanova
117dcdaadb6SLluís Vilanova# @vaddr: Access' virtual address.
118dcdaadb6SLluís Vilanova# @info : Access' information (see below).
119dcdaadb6SLluís Vilanova#
120dcdaadb6SLluís Vilanova# Start virtual memory access (before any potential access violation).
121dcdaadb6SLluís Vilanova#
122dcdaadb6SLluís Vilanova# Does not include memory accesses performed by devices.
123dcdaadb6SLluís Vilanova#
124dcdaadb6SLluís Vilanova# Access information can be parsed as:
125dcdaadb6SLluís Vilanova#
126dcdaadb6SLluís Vilanova# struct mem_info {
127dcdaadb6SLluís Vilanova#     uint8_t size_shift : 2; /* interpreted as "1 << size_shift" bytes */
128dcdaadb6SLluís Vilanova#     bool    sign_extend: 1; /* sign-extended */
129dcdaadb6SLluís Vilanova#     uint8_t endianness : 1; /* 0: little, 1: big */
130dcdaadb6SLluís Vilanova#     bool    store      : 1; /* wheter it's a store operation */
131dcdaadb6SLluís Vilanova# };
132dcdaadb6SLluís Vilanova#
13343e21e49SLluís Vilanova# Mode: user, softmmu
134dcdaadb6SLluís Vilanova# Targets: TCG(all)
135dcdaadb6SLluís Vilanovadisable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
1369c15e700SLluís Vilanova
1379c15e700SLluís Vilanova# @num: System call number.
1389c15e700SLluís Vilanova# @arg*: System call argument value.
1399c15e700SLluís Vilanova#
1409c15e700SLluís Vilanova# Start executing a guest system call in syscall emulation mode.
1419c15e700SLluís Vilanova#
14243e21e49SLluís Vilanova# Mode: user
1439c15e700SLluís Vilanova# Targets: TCG(all)
1449c15e700SLluís Vilanovadisable vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7, uint64_t arg8) "num=0x%016"PRIx64" arg1=0x%016"PRIx64" arg2=0x%016"PRIx64" arg3=0x%016"PRIx64" arg4=0x%016"PRIx64" arg5=0x%016"PRIx64" arg6=0x%016"PRIx64" arg7=0x%016"PRIx64" arg8=0x%016"PRIx64
1459c15e700SLluís Vilanova
1469c15e700SLluís Vilanova# @num: System call number.
1479c15e700SLluís Vilanova# @ret: System call result value.
1489c15e700SLluís Vilanova#
1499c15e700SLluís Vilanova# Finish executing a guest system call in syscall emulation mode.
1509c15e700SLluís Vilanova#
15143e21e49SLluís Vilanova# Mode: user
1529c15e700SLluís Vilanova# Targets: TCG(all)
1539c15e700SLluís Vilanovadisable vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64
154