aboutsummaryrefslogtreecommitdiff
path: root/trace/control.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-06-01 15:24:03 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2021-07-12 17:37:07 +0100
commit117856c3748dfda50351d1c0328486ede5f2646c (patch)
treed8c7d94d85dc89e8c5bbcea24bf1051b0a22f40f /trace/control.c
parent2adf2164918e2dc74fef2cdd0257917aff488640 (diff)
downloadqemu-117856c3748dfda50351d1c0328486ede5f2646c.zip
qemu-117856c3748dfda50351d1c0328486ede5f2646c.tar.gz
qemu-117856c3748dfda50351d1c0328486ede5f2646c.tar.bz2
trace: iter init tweaks
Rename trace_event_iter_init() to trace_event_iter_init_pattern(), add trace_event_iter_init_all() for interating over all events. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20210601132414.432430-3-kraxel@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace/control.c')
-rw-r--r--trace/control.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/trace/control.c b/trace/control.c
index 4be38e1..ed38e81 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -91,7 +91,7 @@ TraceEvent *trace_event_name(const char *name)
TraceEventIter iter;
TraceEvent *ev;
- trace_event_iter_init(&iter, NULL);
+ trace_event_iter_init_all(&iter);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
if (strcmp(trace_event_get_name(ev), name) == 0) {
return ev;
@@ -100,10 +100,16 @@ TraceEvent *trace_event_name(const char *name)
return NULL;
}
-void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
+void trace_event_iter_init_all(TraceEventIter *iter)
{
iter->event = 0;
iter->group = 0;
+ iter->pattern = NULL;
+}
+
+void trace_event_iter_init_pattern(TraceEventIter *iter, const char *pattern)
+{
+ trace_event_iter_init_all(iter);
iter->pattern = pattern;
}
@@ -130,7 +136,7 @@ void trace_list_events(FILE *f)
{
TraceEventIter iter;
TraceEvent *ev;
- trace_event_iter_init(&iter, NULL);
+ trace_event_iter_init_all(&iter);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
fprintf(f, "%s\n", trace_event_get_name(ev));
}
@@ -150,7 +156,7 @@ static void do_trace_enable_events(const char *line_buf)
TraceEvent *ev;
bool is_pattern = trace_event_is_pattern(line_ptr);
- trace_event_iter_init(&iter, line_ptr);
+ trace_event_iter_init_pattern(&iter, line_ptr);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
if (!trace_event_get_state_static(ev)) {
if (!is_pattern) {
@@ -256,7 +262,7 @@ void trace_fini_vcpu(CPUState *vcpu)
trace_guest_cpu_exit(vcpu);
- trace_event_iter_init(&iter, NULL);
+ trace_event_iter_init_all(&iter);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
if (trace_event_is_vcpu(ev) &&
trace_event_get_state_static(ev) &&