2 * Copyright (c) 2010-2011 IBM
5 * Chunqiang Tang <ctang@us.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2.
8 * See the COPYING file in the top-level directory.
11 /*=============================================================================
12 * A short description: this module implements the qemu-tool functions that
13 * are related to time. In the simulation mode (see block/sim.c), these
14 * functions are implemented differently in qemu-test.c because they have to
15 * work with the simulation engine block/sim.c
16 *============================================================================*/
18 #include "qemu/timer.h"
27 int64_t qemu_get_clock (QEMUClock
* clock
)
30 qemu_gettimeofday (&tv
);
31 return (tv
.tv_sec
* 1000000000LL + (tv
.tv_usec
* 1000)) / 1000000;
35 QEMUBH
*qemu_bh_new (QEMUBHFunc
* cb
, void *opaque
)
39 bh
= g_malloc(sizeof(*bh
));
46 int qemu_bh_poll (void)
51 void qemu_bh_schedule (QEMUBH
* bh
)
56 void qemu_bh_cancel (QEMUBH
* bh
)
60 void qemu_bh_delete (QEMUBH
* bh
)
65 void timer_mod(QEMUTimer
* ts
, int64_t expire_time
)
67 fprintf (stderr
, "timer_mod() should not be invoked in qemu-tool\n");
71 QEMUTimer
*qemu_new_timer (QEMUClock
* clock
, QEMUTimerCB
* cb
, void *opaque
)
73 fprintf (stderr
, "qemu_new_timer() should not be invoked in qemu-tool\n");
78 void timer_free(QEMUTimer
* ts
)
80 fprintf (stderr
, "timer_free() should not be invoked in qemu-tool\n");
84 void timer_del(QEMUTimer
* ts
)
86 fprintf (stderr
, "timer_del() should not be invoked in qemu-tool\n");