image-fuzzer: Use errors parameter of subprocess.Popen()
[qemu/kevin.git] / replay / replay-time.c
blob43357c9f2455ad7da4e83ac0654e96e53951484c
1 /*
2 * replay-time.c
4 * Copyright (c) 2010-2015 Institute for System Programming
5 * of the Russian Academy of Sciences.
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
12 #include "qemu/osdep.h"
13 #include "sysemu/replay.h"
14 #include "replay-internal.h"
15 #include "qemu/error-report.h"
17 int64_t replay_save_clock(ReplayClockKind kind, int64_t clock,
18 int64_t raw_icount)
20 g_assert(replay_file);
21 g_assert(replay_mutex_locked());
24 * Due to the caller's locking requirements we get the icount from it
25 * instead of using replay_save_instructions().
27 replay_advance_current_icount(raw_icount);
28 replay_put_event(EVENT_CLOCK + kind);
29 replay_put_qword(clock);
31 return clock;
34 void replay_read_next_clock(ReplayClockKind kind)
36 unsigned int read_kind = replay_state.data_kind - EVENT_CLOCK;
38 assert(read_kind == kind);
40 int64_t clock = replay_get_qword();
42 replay_check_error();
43 replay_finish_event();
45 replay_state.cached_clock[read_kind] = clock;
48 /*! Reads next clock event from the input. */
49 int64_t replay_read_clock(ReplayClockKind kind)
51 int64_t ret;
52 g_assert(replay_file && replay_mutex_locked());
54 replay_account_executed_instructions();
56 if (replay_next_event_is(EVENT_CLOCK + kind)) {
57 replay_read_next_clock(kind);
59 ret = replay_state.cached_clock[kind];
61 return ret;