Improve emulation progress info

Now the progress shows 100% when the emulation ends.
This commit is contained in:
Rodrigo Arias 2022-09-30 11:44:06 +02:00
parent 529cf2da16
commit 404182c5fa

View File

@ -452,15 +452,9 @@ static void
emulate(struct ovni_emu *emu) emulate(struct ovni_emu *emu)
{ {
emu->nev_processed = 0; emu->nev_processed = 0;
err("loading first events\n");
emu_load_first_events(emu); emu_load_first_events(emu);
err("emulation starts\n");
emu->start_emulation_time = get_time(); emu->start_emulation_time = get_time();
hook_init(emu); hook_init(emu);
emit_channels(emu); emit_channels(emu);
/* Then process all events */ /* Then process all events */
@ -485,7 +479,6 @@ emulate(struct ovni_emu *emu)
} }
hook_end(emu); hook_end(emu);
print_progress(emu); print_progress(emu);
} }
@ -1040,6 +1033,9 @@ emu_init(struct ovni_emu *emu, int argc, char *argv[])
emu->global_size = 0; emu->global_size = 0;
emu->global_offset = 0; emu->global_offset = 0;
for (size_t i = 0; i < emu->trace.nstreams; i++)
emu->global_offset += emu->trace.stream[i].offset;
err("loaded %ld cpus and %ld threads\n", err("loaded %ld cpus and %ld threads\n",
emu->total_ncpus, emu->total_ncpus,
emu->total_nthreads); emu->total_nthreads);
@ -1119,16 +1115,12 @@ main(int argc, char *argv[])
} }
emu_init(emu, argc, argv); emu_init(emu, argc, argv);
err("emulation starts\n");
emulate(emu); emulate(emu);
emu_post(emu); emu_post(emu);
emu_destroy(emu); emu_destroy(emu);
err("emulation ends\n");
free(emu); free(emu);
err("ovniemu finished\n");
return 0; return 0;
} }