2 * Stubs for the ptimer-test
4 * Author: Dmitry Osipenko <digetx@gmail.com>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
11 #include "qemu/osdep.h"
12 #include "qemu/main-loop.h"
13 #include "sysemu/replay.h"
15 #include "ptimer-test.h"
22 QEMUTimerListGroup main_loop_tlg
;
24 int64_t ptimer_test_time_ns
;
26 void timer_init_tl(QEMUTimer
*ts
,
27 QEMUTimerList
*timer_list
, int scale
,
28 QEMUTimerCB
*cb
, void *opaque
)
30 ts
->timer_list
= timer_list
;
37 void timer_mod(QEMUTimer
*ts
, int64_t expire_time
)
39 QEMUTimerList
*timer_list
= ts
->timer_list
;
40 QEMUTimer
*t
= &timer_list
->active_timers
;
42 while (t
->next
!= NULL
) {
50 ts
->expire_time
= MAX(expire_time
* ts
->scale
, 0);
55 void timer_del(QEMUTimer
*ts
)
57 QEMUTimerList
*timer_list
= ts
->timer_list
;
58 QEMUTimer
*t
= &timer_list
->active_timers
;
60 while (t
->next
!= NULL
) {
70 int64_t qemu_clock_get_ns(QEMUClockType type
)
72 return ptimer_test_time_ns
;
75 int64_t qemu_clock_deadline_ns_all(QEMUClockType type
)
77 QEMUTimerList
*timer_list
= main_loop_tlg
.tl
[type
];
78 QEMUTimer
*t
= timer_list
->active_timers
.next
;
79 int64_t deadline
= -1;
83 deadline
= t
->expire_time
;
85 deadline
= MIN(deadline
, t
->expire_time
);
94 QEMUBH
*qemu_bh_new(QEMUBHFunc
*cb
, void *opaque
)
96 QEMUBH
*bh
= g_new(QEMUBH
, 1);
104 void replay_bh_schedule_event(QEMUBH
*bh
)