mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06: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
|
@ -936,16 +936,18 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef trace_event_get_state
|
||||
static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
|
||||
{
|
||||
bool print16 = !!trace_event_get_state(TRACE_USB_OHCI_TD_PKT_SHORT);
|
||||
bool printall = !!trace_event_get_state(TRACE_USB_OHCI_TD_PKT_FULL);
|
||||
bool print16;
|
||||
bool printall;
|
||||
const int width = 16;
|
||||
int i;
|
||||
char tmp[3 * width + 1];
|
||||
char *p = tmp;
|
||||
|
||||
print16 = !!trace_event_get_state_backends(TRACE_USB_OHCI_TD_PKT_SHORT);
|
||||
printall = !!trace_event_get_state_backends(TRACE_USB_OHCI_TD_PKT_FULL);
|
||||
|
||||
if (!printall && !print16) {
|
||||
return;
|
||||
}
|
||||
|
@ -967,11 +969,6 @@ static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
|
|||
p += sprintf(p, " %.2x", buf[i]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Service a transport descriptor.
|
||||
Returns nonzero to terminate processing of this endpoint. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue