From 1aae200614ede08dfc99d27c54bc6f7e8c885f04 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 16 Dec 2021 13:30:26 +0100 Subject: [PATCH] Use pointers instead of indexes in streams --- dump.c | 11 ++++++++--- emu.c | 14 ++++++++------ emu.h | 6 +++--- trace.c | 6 +++--- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/dump.c b/dump.c index 91840a3..f28201b 100644 --- a/dump.c +++ b/dump.c @@ -66,9 +66,14 @@ emit(struct ovni_stream *stream, struct ovni_ev *ev) delta = clock - stream->lastclock; - printf("%d.%d.%d %c %c %c % 20ld % 15ld ", - stream->loom, stream->proc, stream->tid, - ev->header.model, ev->header.category, ev->header.value, clock, delta); + printf("%s.%d.%d %c %c %c % 20ld % 15ld ", + stream->loom->hostname, + stream->proc->pid, + stream->thread->tid, + ev->header.model, + ev->header.category, + ev->header.value, + clock, delta); payloadsize = ovni_payload_size(ev); for(i=0; ilastclock; - dbg(">>> %d.%d.%d %c %c %c % 20ld % 15ld ", - stream->loom, stream->proc, stream->tid, + dbg(">>> %s.%d.%d %c %c %c % 20ld % 15ld ", + stream->loom->hostname, + stream->proc->pid, + stream->thread->tid, ev->header.model, ev->header.category, ev->header.value, clock, delta); payloadsize = ovni_payload_size(ev); @@ -298,9 +300,9 @@ set_current(struct ovni_emu *emu, struct ovni_stream *stream) { emu->cur_stream = stream; emu->cur_ev = stream->cur_ev; - emu->cur_loom = &emu->trace.loom[stream->loom]; - emu->cur_proc = &emu->cur_loom->proc[stream->proc]; - emu->cur_thread = &emu->cur_proc->thread[stream->thread]; + emu->cur_loom = stream->loom; + emu->cur_proc = stream->proc; + emu->cur_thread = stream->thread; } /* @@ -922,7 +924,7 @@ load_clock_offsets(struct ovni_emu *emu) for(i=0; instreams; i++) { stream = &trace->stream[i]; - loom = &trace->loom[stream->loom]; + loom = stream->loom; stream->clock_offset = loom->clock_offset; } diff --git a/emu.h b/emu.h index 67138d2..92176b9 100644 --- a/emu.h +++ b/emu.h @@ -418,9 +418,9 @@ struct ovni_stream { size_t offset; int tid; - int thread; - int proc; - int loom; + struct ovni_loom *loom; + struct ovni_eproc *proc; + struct ovni_ethread *thread; int loaded; int active; diff --git a/trace.c b/trace.c index 0a3a752..7c53287 100644 --- a/trace.c +++ b/trace.c @@ -515,9 +515,9 @@ ovni_load_streams(struct ovni_trace *trace) stream = &trace->stream[s++]; stream->tid = thread->tid; - stream->thread = k; - stream->proc = j; - stream->loom = i; + stream->thread = thread; + stream->proc = proc; + stream->loom = loom; stream->lastclock = 0; stream->offset = 0; stream->cur_ev = NULL;