/* Sets a rate limit on a particular event, so no more than 1 event will be emitted within @rate milliseconds  */
static void monitor_protocol_event_throttle(MonitorEvent event, int64_t rate)
/* Sets a rate limit on a particular event, so no more than 1 event will be emitted within @rate milliseconds  */
static void monitor_protocol_event_throttle(MonitorEvent event, int64_t rate)
{
    MonitorEventState *evstate;
    assert(event < QEVENT_MAX);
    evstate = &(monitor_event_state[event]);
    trace_monitor_protocol_event_throttle(event, rate);
    evstate->event = event;
    evstate->rate = rate * SCALE_MS;
    evstate->timer = timer_new(QEMU_CLOCK_REALTIME,
                                    SCALE_MS,
                                    monitor_protocol_event_handler,
                                    evstate);
    evstate->last = 0;
    evstate->data = NULL;
}