mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
Replace qemu_gettimeofday() with g_get_real_time()
GLib g_get_real_time() is an alternative to gettimeofday() which allows to simplify our code. For semihosting, a few bits are lost on POSIX host, but this shouldn't be a big concern. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220307070401.171986-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
287698e50f
commit
f793dde091
7 changed files with 35 additions and 50 deletions
|
@ -452,7 +452,6 @@ static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
|
|||
VirtQueueElement *elem;
|
||||
VirtIOBalloonStat stat;
|
||||
size_t offset = 0;
|
||||
qemu_timeval tv;
|
||||
|
||||
elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
|
||||
if (!elem) {
|
||||
|
@ -484,13 +483,7 @@ static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
|
|||
s->stats[tag] = val;
|
||||
}
|
||||
s->stats_vq_offset = offset;
|
||||
|
||||
if (qemu_gettimeofday(&tv) < 0) {
|
||||
warn_report("%s: failed to get time of day", __func__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->stats_last_update = tv.tv_sec;
|
||||
s->stats_last_update = g_get_real_time() / G_USEC_PER_SEC;
|
||||
|
||||
out:
|
||||
if (balloon_stats_enabled(s)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue