Use pointers instead of indexes in streams

This commit is contained in:
Rodrigo Arias 2021-12-16 13:30:26 +01:00
parent 568cbb2622
commit 1aae200614
4 changed files with 22 additions and 15 deletions

11
dump.c
View File

@ -66,9 +66,14 @@ emit(struct ovni_stream *stream, struct ovni_ev *ev)
delta = clock - stream->lastclock; delta = clock - stream->lastclock;
printf("%d.%d.%d %c %c %c % 20ld % 15ld ", printf("%s.%d.%d %c %c %c % 20ld % 15ld ",
stream->loom, stream->proc, stream->tid, stream->loom->hostname,
ev->header.model, ev->header.category, ev->header.value, clock, delta); stream->proc->pid,
stream->thread->tid,
ev->header.model,
ev->header.category,
ev->header.value,
clock, delta);
payloadsize = ovni_payload_size(ev); payloadsize = ovni_payload_size(ev);
for(i=0; i<payloadsize; i++) for(i=0; i<payloadsize; i++)

14
emu.c
View File

@ -59,8 +59,10 @@ print_ev(struct ovni_stream *stream, struct ovni_ev *ev)
delta = clock - stream->lastclock; delta = clock - stream->lastclock;
dbg(">>> %d.%d.%d %c %c %c % 20ld % 15ld ", dbg(">>> %s.%d.%d %c %c %c % 20ld % 15ld ",
stream->loom, stream->proc, stream->tid, stream->loom->hostname,
stream->proc->pid,
stream->thread->tid,
ev->header.model, ev->header.category, ev->header.value, clock, delta); ev->header.model, ev->header.category, ev->header.value, clock, delta);
payloadsize = ovni_payload_size(ev); 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_stream = stream;
emu->cur_ev = stream->cur_ev; emu->cur_ev = stream->cur_ev;
emu->cur_loom = &emu->trace.loom[stream->loom]; emu->cur_loom = stream->loom;
emu->cur_proc = &emu->cur_loom->proc[stream->proc]; emu->cur_proc = stream->proc;
emu->cur_thread = &emu->cur_proc->thread[stream->thread]; emu->cur_thread = stream->thread;
} }
/* /*
@ -922,7 +924,7 @@ load_clock_offsets(struct ovni_emu *emu)
for(i=0; i<trace->nstreams; i++) for(i=0; i<trace->nstreams; i++)
{ {
stream = &trace->stream[i]; stream = &trace->stream[i];
loom = &trace->loom[stream->loom]; loom = stream->loom;
stream->clock_offset = loom->clock_offset; stream->clock_offset = loom->clock_offset;
} }

6
emu.h
View File

@ -418,9 +418,9 @@ struct ovni_stream {
size_t offset; size_t offset;
int tid; int tid;
int thread; struct ovni_loom *loom;
int proc; struct ovni_eproc *proc;
int loom; struct ovni_ethread *thread;
int loaded; int loaded;
int active; int active;

View File

@ -515,9 +515,9 @@ ovni_load_streams(struct ovni_trace *trace)
stream = &trace->stream[s++]; stream = &trace->stream[s++];
stream->tid = thread->tid; stream->tid = thread->tid;
stream->thread = k; stream->thread = thread;
stream->proc = j; stream->proc = proc;
stream->loom = i; stream->loom = loom;
stream->lastclock = 0; stream->lastclock = 0;
stream->offset = 0; stream->offset = 0;
stream->cur_ev = NULL; stream->cur_ev = NULL;