[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits |
Date: |
Fri, 5 Oct 2018 16:48:54 +0100 |
When working via the HMP to dynamically enable trace points it would
be useful to know if trace points are currently being hit. As the cost
is low we can simply increment a counter as we consider if we are
going to trace the event.
This cannot be precise as we don't take care to use atomic accesses
but it is usefully indicative.
Signed-off-by: Alex Bennée <address@hidden>
---
scripts/tracetool/backend/simple.py | 2 ++
trace/event-internal.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/scripts/tracetool/backend/simple.py
b/scripts/tracetool/backend/simple.py
index c2fd1c24c4..eaa19a1032 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -81,6 +81,8 @@ def generate_c(event, group):
cond = "trace_event_get_state(%s)" % event_id
out('',
+ ' %(event_obj)s.count++;',
+ '',
' if (!%(cond)s) {',
' return;',
' }',
diff --git a/trace/event-internal.h b/trace/event-internal.h
index f63500b37e..8ab3a29941 100644
--- a/trace/event-internal.h
+++ b/trace/event-internal.h
@@ -37,6 +37,7 @@ typedef struct TraceEvent {
const char * name;
const bool sstate;
uint16_t *dstate;
+ uint64_t count;
} TraceEvent;
void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state);
--
2.17.1
- [Qemu-devel] [RFC PATCH 08/21] accel/tcg/cputlb: convert remaining tlb_debug() to trace events, (continued)
- [Qemu-devel] [RFC PATCH 04/21] trace: enable the exec_tb trace events, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 01/21] util/log: allow -dfilter to stack, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits,
Alex Bennée <=
- [Qemu-devel] [RFC PATCH 18/21] linux-user: allow dumping of plugin status at end of run, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 10/21] qom/cpu: add a cpu_exit trace event, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 12/21] configure: expose a plugin to the trace-backends, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 09/21] trace: suppress log output of trace points, Alex Bennée, 2018/10/05