4 * Copyright (c) 2014 Wenchao Xia
7 * Wenchao Xia <wenchaoqemu@gmail.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
14 #include "qemu/osdep.h"
16 #include "qemu-common.h"
17 #include "qapi/qmp-event.h"
18 #include "qapi/qmp/qstring.h"
19 #include "qapi/qmp/qjson.h"
21 static QMPEventFuncEmit qmp_emit
;
23 void qmp_event_set_func_emit(QMPEventFuncEmit emit
)
28 QMPEventFuncEmit
qmp_event_get_func_emit(void)
33 static void timestamp_put(QDict
*qdict
)
40 err
= qemu_gettimeofday(&tv
);
42 /* Put -1 to indicate failure of getting host time */
50 obj
= qobject_from_jsonf("{ 'seconds': %" PRId64
", "
51 "'microseconds': %" PRId64
" }",
53 qdict_put_obj(qdict
, "timestamp", obj
);
57 * Build a QDict, then fill event name and time stamp, caller should free the
60 QDict
*qmp_event_build_dict(const char *event_name
)
62 QDict
*dict
= qdict_new();
63 qdict_put(dict
, "event", qstring_from_str(event_name
));