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;
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; 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;
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; i<trace->nstreams; i++)
{
stream = &trace->stream[i];
loom = &trace->loom[stream->loom];
loom = stream->loom;
stream->clock_offset = loom->clock_offset;
}

6
emu.h
View File

@ -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;

View File

@ -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;