mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
trace: add trace_event_get_state_backends()
Code that checks dstate is unaware of SystemTap and LTTng UST dstate, so
the following trace event will not fire when solely enabled by SystemTap
or LTTng UST:
if (trace_event_get_state(TRACE_MY_EVENT)) {
str = g_strdup_printf("Expensive string to generate ...",
...);
trace_my_event(str);
g_free(str);
}
Add trace_event_get_state_backends() to fetch backend dstate. Those
backends that use QEMU dstate fetch it as part of
generate_h_backend_dstate().
Update existing trace_event_get_state() callers to use
trace_event_get_state_backends() instead.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170731140718.22010-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
3932ef3ffb
commit
d87aa13803
5 changed files with 31 additions and 17 deletions
|
|
@ -96,7 +96,7 @@ static const char * trace_event_get_name(TraceEvent *ev);
|
|||
* trace_event_get_state:
|
||||
* @id: Event identifier name.
|
||||
*
|
||||
* Get the tracing state of an event (both static and dynamic).
|
||||
* Get the tracing state of an event, both static and the QEMU dynamic state.
|
||||
*
|
||||
* If the event has the disabled property, the check will have no performance
|
||||
* impact.
|
||||
|
|
@ -104,6 +104,22 @@ static const char * trace_event_get_name(TraceEvent *ev);
|
|||
#define trace_event_get_state(id) \
|
||||
((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id))
|
||||
|
||||
/**
|
||||
* trace_event_get_state_backends:
|
||||
* @id: Event identifier name.
|
||||
*
|
||||
* Get the tracing state of an event, both static and dynamic state from all
|
||||
* compiled-in backends.
|
||||
*
|
||||
* If the event has the disabled property, the check will have no performance
|
||||
* impact.
|
||||
*
|
||||
* Returns: true if at least one backend has the event enabled and the event
|
||||
* does not have the disabled property.
|
||||
*/
|
||||
#define trace_event_get_state_backends(id) \
|
||||
((id ##_ENABLED) && id ##_BACKEND_DSTATE())
|
||||
|
||||
/**
|
||||
* trace_event_get_vcpu_state:
|
||||
* @vcpu: Target vCPU.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue