 cd245a1932
			
		
	
	
		cd245a1932
		
	
	
	
	
		
			
			It is often useful to instrument memory management functions in order to find leaks or performance problems. This patch adds trace events for the memory allocation primitives. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # Trace events for debugging and performance instrumentation
 | |
| #
 | |
| # This file is processed by the tracetool script during the build.
 | |
| #
 | |
| # To add a new trace event:
 | |
| #
 | |
| # 1. Choose a name for the trace event.  Declare its arguments and format
 | |
| #    string.
 | |
| #
 | |
| # 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
 | |
| #    trace_multiwrite_cb().  The source file must #include "trace.h".
 | |
| #
 | |
| # Format of a trace event:
 | |
| #
 | |
| # [disable] <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
 | |
| #
 | |
| # Example: qemu_malloc(size_t size) "size %zu"
 | |
| #
 | |
| # The "disable" keyword will build without the trace event.
 | |
| # In case of 'simple' trace backend, it will allow the trace event to be
 | |
| # compiled, but this would be turned off by default. It can be toggled on via
 | |
| # the monitor.
 | |
| #
 | |
| # The <name> must be a valid as a C function name.
 | |
| #
 | |
| # Types should be standard C types.  Use void * for pointers because the trace
 | |
| # system may not have the necessary headers included.
 | |
| #
 | |
| # The <format-string> should be a sprintf()-compatible format string.
 | |
| 
 | |
| # qemu-malloc.c
 | |
| disable qemu_malloc(size_t size, void *ptr) "size %zu ptr %p"
 | |
| disable qemu_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
 | |
| disable qemu_free(void *ptr) "ptr %p"
 | |
| 
 | |
| # osdep.c
 | |
| disable qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
 | |
| disable qemu_valloc(size_t size, void *ptr) "size %zu ptr %p"
 | |
| disable qemu_vfree(void *ptr) "ptr %p"
 |