diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2021-06-01 15:24:05 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2021-07-12 17:37:07 +0100 |
commit | 3f2a09842f989af020b8355622d5f7fa9bdeb832 (patch) | |
tree | f17ca9a8578e3c27937393bb5c40ce93ee8de168 /trace/simple.c | |
parent | c5cc58b176f23f6664d0e12e5956af4d904dcca4 (diff) | |
download | qemu-3f2a09842f989af020b8355622d5f7fa9bdeb832.zip qemu-3f2a09842f989af020b8355622d5f7fa9bdeb832.tar.gz qemu-3f2a09842f989af020b8355622d5f7fa9bdeb832.tar.bz2 |
trace/simple: pass iter to st_write_event_mapping
Pass an iter to st_write_event_mapping, so the function can interate
different things depending on how we initialize the iter.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20210601132414.432430-5-kraxel@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace/simple.c')
-rw-r--r-- | trace/simple.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/trace/simple.c b/trace/simple.c index 97b6f85..ec2156d 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -280,14 +280,12 @@ void trace_record_finish(TraceBufferRecord *rec) } } -static int st_write_event_mapping(void) +static int st_write_event_mapping(TraceEventIter *iter) { uint64_t type = TRACE_RECORD_TYPE_MAPPING; - TraceEventIter iter; TraceEvent *ev; - trace_event_iter_init_all(&iter); - while ((ev = trace_event_iter_next(&iter)) != NULL) { + while ((ev = trace_event_iter_next(iter)) != NULL) { uint64_t id = trace_event_get_id(ev); const char *name = trace_event_get_name(ev); uint32_t len = strlen(name); @@ -309,6 +307,7 @@ static int st_write_event_mapping(void) */ bool st_set_trace_file_enabled(bool enable) { + TraceEventIter iter; bool was_enabled = trace_fp; if (enable == !!trace_fp) { @@ -333,8 +332,9 @@ bool st_set_trace_file_enabled(bool enable) return was_enabled; } + trace_event_iter_init_all(&iter); if (fwrite(&header, sizeof header, 1, trace_fp) != 1 || - st_write_event_mapping() < 0) { + st_write_event_mapping(&iter) < 0) { fclose(trace_fp); trace_fp = NULL; return was_enabled; |