aboutsummaryrefslogtreecommitdiff
path: root/replay/replay-snapshot.c
diff options
context:
space:
mode:
Diffstat (limited to 'replay/replay-snapshot.c')
-rw-r--r--replay/replay-snapshot.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index b2e1076..2ab85cf 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -25,6 +25,7 @@ static int replay_pre_save(void *opaque)
{
ReplayState *state = opaque;
state->file_offset = ftell(replay_file);
+ state->host_clock_last = qemu_clock_get_last(QEMU_CLOCK_HOST);
return 0;
}
@@ -33,6 +34,7 @@ static int replay_post_load(void *opaque, int version_id)
{
ReplayState *state = opaque;
fseek(replay_file, state->file_offset, SEEK_SET);
+ qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last);
/* If this was a vmstate, saved in recording mode,
we need to initialize replay data fields. */
replay_fetch_data_kind();
@@ -54,6 +56,10 @@ static const VMStateDescription vmstate_replay = {
VMSTATE_UINT32(has_unread_data, ReplayState),
VMSTATE_UINT64(file_offset, ReplayState),
VMSTATE_UINT64(block_request_id, ReplayState),
+ VMSTATE_UINT64(host_clock_last, ReplayState),
+ VMSTATE_INT32(read_event_kind, ReplayState),
+ VMSTATE_UINT64(read_event_id, ReplayState),
+ VMSTATE_INT32(read_event_checkpoint, ReplayState),
VMSTATE_END_OF_LIST()
},
};
@@ -83,3 +89,9 @@ void replay_vmstate_init(void)
}
}
}
+
+bool replay_can_snapshot(void)
+{
+ return replay_mode == REPLAY_MODE_NONE
+ || !replay_has_events();
+}