- Notifications
You must be signed in to change notification settings - Fork 0
Profiling with QEMU
To enable logging, it is necessary to provide the enabled log levels with the -d flag. Some of the more relevant ones are:
in_asm show target assembly code for each compiled TB nochain do not chain compiled TBs so that "exec" and "cpu" show complete traces exec show trace before each executed TB (lots of logs) cpu show CPU registers before entering a TB (lots of logs) fpu include FPU registers in the 'cpu' logging int show interrupts/exceptions in short format mmu log MMU-related activities unimp log unimplemented functionalityTo get a complete listing, run qemu-system-arc -d help. Use -D <logfile> to dump the logs into a file instead of standard output.
QEMU provides a tracing infrastructure which may help in debugging or analyzing what happens within a simulation cycle. At this moment, there are two tracers added into ARC backend, one for MMU operations, and another for exceptions:
# mmu.c mmu_command(uint32_t address, const char *command, uint32_t pd0, uint32_t pd1) "[MMU] at 0x%08x, CMD=%s, PD0=0x%08x, PD1=0x%08x" # helper.c excp_info(uint32_t address, const char *name) "[IRQ] at 0x08, Exception=%s"Firstly, build QEMU with the --enable-trace-backends=simple configure parameter. Then Create a file with the events you want to trace. For example, here is such file with name events.trc:
mmu_command excp_info Run the virtual machine to produce a trace file:
$ qemu-system-arc --trace events=events.trc ...Pretty-print the binary trace file (override <pid> with QEMU process id for you session):
$ <QEMU-source-tree-path>/scripts/simpletrace.py <QEMU-source-tree-path>/target/arc/trace-events trace-<pid>