Allow ovnidump to load unsorted traces
This commit is contained in:
parent
2fbf022823
commit
c6860854b4
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define _POSIX_C_SOURCE 2
|
#define _POSIX_C_SOURCE 2
|
||||||
|
|
||||||
#define ENABLE_DEBUG
|
//#define ENABLE_DEBUG
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ emu_init(struct emu *emu, int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player_init(&emu->player, &emu->trace) != 0) {
|
if (player_init(&emu->player, &emu->trace, 0) != 0) {
|
||||||
err("cannot init player for trace '%s'\n",
|
err("cannot init player for trace '%s'\n",
|
||||||
emu->args.tracedir);
|
emu->args.tracedir);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -99,7 +99,7 @@ main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player_init(player, trace) != 0) {
|
if (player_init(player, trace, 1) != 0) {
|
||||||
err("player_init failed");
|
err("player_init failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ check_clock_gate(struct trace *trace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
player_init(struct player *player, struct trace *trace)
|
player_init(struct player *player, struct trace *trace, int unsorted)
|
||||||
{
|
{
|
||||||
memset(player, 0, sizeof(struct player));
|
memset(player, 0, sizeof(struct player));
|
||||||
|
|
||||||
@ -98,10 +98,14 @@ player_init(struct player *player, struct trace *trace)
|
|||||||
player->first_event = 1;
|
player->first_event = 1;
|
||||||
player->stream = NULL;
|
player->stream = NULL;
|
||||||
player->trace = trace;
|
player->trace = trace;
|
||||||
|
player->unsorted = unsorted;
|
||||||
|
|
||||||
/* Load initial streams and events */
|
/* Load initial streams and events */
|
||||||
struct stream *stream;
|
struct stream *stream;
|
||||||
DL_FOREACH(trace->streams, stream) {
|
DL_FOREACH(trace->streams, stream) {
|
||||||
|
if (unsorted)
|
||||||
|
stream_allow_unsorted(stream);
|
||||||
|
|
||||||
int ret = step_stream(player, stream);
|
int ret = step_stream(player, stream);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
/* No more events */
|
/* No more events */
|
||||||
@ -114,8 +118,8 @@ player_init(struct player *player, struct trace *trace)
|
|||||||
|
|
||||||
/* Ensure the first event sclocks are not too far apart. Otherwise an
|
/* Ensure the first event sclocks are not too far apart. Otherwise an
|
||||||
* offset table is mandatory. */
|
* offset table is mandatory. */
|
||||||
if (check_clock_gate(trace) != 0) {
|
if (unsorted == 0 && check_clock_gate(trace) != 0) {
|
||||||
err("check_clock_gate failed\n");
|
err("check_clock_gate failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,9 +151,10 @@ update_clocks(struct player *player, struct stream *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sclock < player->lastclock) {
|
if (sclock < player->lastclock) {
|
||||||
err("backwards jump in time %ld -> %ld in stream '%s'\n",
|
err("backwards jump in time %ld -> %ld in stream '%s'",
|
||||||
player->lastclock, sclock, stream->relpath);
|
player->lastclock, sclock, stream->relpath);
|
||||||
return -1;
|
if (player->unsorted == 0)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->lastclock = sclock;
|
player->lastclock = sclock;
|
||||||
|
@ -16,11 +16,12 @@ struct player {
|
|||||||
int64_t lastclock;
|
int64_t lastclock;
|
||||||
int64_t deltaclock;
|
int64_t deltaclock;
|
||||||
int first_event;
|
int first_event;
|
||||||
|
int unsorted;
|
||||||
struct stream *stream;
|
struct stream *stream;
|
||||||
struct emu_ev ev;
|
struct emu_ev ev;
|
||||||
};
|
};
|
||||||
|
|
||||||
int player_init(struct player *player, struct trace *trace);
|
int player_init(struct player *player, struct trace *trace, int unsorted);
|
||||||
int player_step(struct player *player);
|
int player_step(struct player *player);
|
||||||
struct emu_ev *player_ev(struct player *player);
|
struct emu_ev *player_ev(struct player *player);
|
||||||
struct stream *player_stream(struct player *player);
|
struct stream *player_stream(struct player *player);
|
||||||
|
Loading…
Reference in New Issue
Block a user