aboutsummaryrefslogtreecommitdiff
path: root/trace/control-internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'trace/control-internal.h')
-rw-r--r--trace/control-internal.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/trace/control-internal.h b/trace/control-internal.h
index b326d88d72..a4e5f4aa06 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -10,8 +10,13 @@
#ifndef TRACE__CONTROL_INTERNAL_H
#define TRACE__CONTROL_INTERNAL_H
+#include <stddef.h> /* size_t */
+
+#include "qom/cpu.h"
+
+
extern TraceEvent trace_events[];
-extern bool trace_events_dstate[];
+extern uint16_t trace_events_dstate[];
extern int trace_events_enabled_count;
@@ -74,13 +79,24 @@ static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
return trace_event_get_state_dynamic_by_id(id);
}
-static inline void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
+ TraceEventVCPUID id)
{
- int id = trace_event_get_id(ev);
- assert(ev != NULL);
- assert(trace_event_get_state_static(ev));
- trace_events_enabled_count += state - trace_events_dstate[id];
- trace_events_dstate[id] = state;
+ /* it's on fast path, avoid consistency checks (asserts) */
+ if (unlikely(trace_events_enabled_count)) {
+ return test_bit(id, vcpu->trace_dstate);
+ } else {
+ return false;
+ }
+}
+
+static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
+ TraceEvent *ev)
+{
+ TraceEventVCPUID id;
+ assert(trace_event_is_vcpu(ev));
+ id = trace_event_get_vcpu_id(ev);
+ return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, id);
}
#endif /* TRACE__CONTROL_INTERNAL_H */