diff --git a/trace-events b/trace-events index a37d3cc6e3..2a986ecd29 100644 --- a/trace-events +++ b/trace-events @@ -12,10 +12,15 @@ # # Format of a trace event: # -# ( [, ] ...) "" +# [disable] ( [, ] ...) "" # # 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 must be a valid as a C function name. # # Types should be standard C types. Use void * for pointers because the trace diff --git a/tracetool b/tracetool index 2e2e37dbd3..8aeac4870b 100755 --- a/tracetool +++ b/tracetool @@ -87,6 +87,20 @@ get_fmt() echo "$fmt" } +# Get the state of a trace event +get_state() +{ + local str disable state + str=$(get_name "$1") + disable=${str##disable } + if [ "$disable" = "$str" ] ; then + state=1 + else + state=0 + fi + echo "$state" +} + linetoh_begin_nop() { return @@ -146,10 +160,14 @@ cast_args_to_uint64_t() linetoh_simple() { - local name args argc trace_args + local name args argc trace_args state name=$(get_name "$1") args=$(get_args "$1") argc=$(get_argc "$1") + state=$(get_state "$1") + if [ "$state" = "0" ]; then + name=${name##disable } + fi trace_args="$simple_event_num" if [ "$argc" -gt 0 ] @@ -188,10 +206,14 @@ EOF linetoc_simple() { - local name + local name state name=$(get_name "$1") + state=$(get_state "$1") + if [ "$state" = "0" ] ; then + name=${name##disable } + fi cat <