aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-07-31 15:07:18 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-08-01 12:13:07 +0100
commitd87aa138039a4be6d705793fd3e397c69c52405a (patch)
treef0880c8b8daf9469aa4df2c93b256d3f044898ce /hw/usb
parent3932ef3ffb54baf22ab05767e827bda1834d20df (diff)
downloadqemu-d87aa138039a4be6d705793fd3e397c69c52405a.zip
qemu-d87aa138039a4be6d705793fd3e397c69c52405a.tar.gz
qemu-d87aa138039a4be6d705793fd3e397c69c52405a.tar.bz2
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>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/hcd-ohci.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 3ada35e..267982e 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -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. */