本文整理汇总了C++中qemu_notify_event函数的典型用法代码示例。如果您正苦于以下问题:C++ qemu_notify_event函数的具体用法?C++ qemu_notify_event怎么用?C++ qemu_notify_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qemu_notify_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qemu_tcg_init_cpu_signals
static void *qemu_tcg_cpu_thread_fn(void *arg)
{
CPUState *env = arg;
qemu_tcg_init_cpu_signals();
qemu_thread_get_self(env->thread);
/* signal CPU creation */
qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu) {
env->thread_id = qemu_get_thread_id();
env->created = 1;
}
qemu_cond_signal(&qemu_cpu_cond);
/* wait for initial kick-off after machine start */
while (first_cpu->stopped) {
qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
}
while (1) {
cpu_exec_all();
if (use_icount && qemu_next_icount_deadline() <= 0) {
qemu_notify_event();
}
qemu_tcg_wait_io_event();
}
return NULL;
}
示例2: icount_warp_rt
static void icount_warp_rt(void *opaque)
{
if (vm_clock_warp_start == -1) {
return;
}
if (vm_running) {
int64_t clock = qemu_get_clock_ns(rt_clock);
int64_t warp_delta = clock - vm_clock_warp_start;
if (use_icount == 1) {
qemu_icount_bias += warp_delta;
} else {
/*
* In adaptive mode, do not let the vm_clock run too
* far ahead of real time.
*/
int64_t cur_time = cpu_get_clock();
int64_t cur_icount = qemu_get_clock_ns(vm_clock);
int64_t delta = cur_time - cur_icount;
qemu_icount_bias += MIN(warp_delta, delta);
}
if (qemu_timer_expired(active_timers[QEMU_CLOCK_VIRTUAL],
qemu_get_clock_ns(vm_clock))) {
qemu_notify_event();
}
}
vm_clock_warp_start = -1;
}
示例3: qemu_mod_timer_ns
/* modify the current timer so that it will be fired when current_time
>= expire_time. The corresponding callback will be called. */
static void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
{
QEMUTimer **pt, *t;
qemu_del_timer(ts);
/* add the timer in the sorted list */
/* NOTE: this code must be signal safe because
qemu_timer_expired() can be called from a signal. */
pt = &active_timers[ts->clock->type];
for(;;) {
t = *pt;
if (!qemu_timer_expired_ns(t, expire_time)) {
break;
}
pt = &t->next;
}
ts->expire_time = expire_time;
ts->next = *pt;
*pt = ts;
/* Rearm if necessary */
if (pt == &active_timers[ts->clock->type]) {
if (!alarm_timer->pending) {
qemu_rearm_alarm_timer(alarm_timer);
}
/* Interrupt execution to force deadline recalculation. */
qemu_clock_warp(ts->clock);
if (use_icount) {
qemu_notify_event();
}
}
}
示例4: get_console_data
/* triggered by SCLP's read_event_data -
* copy console data byte-stream into provided (SCLP) buffer
*/
static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
int avail)
{
SCLPConsole *cons = SCLP_CONSOLE(event);
/* first byte is hex 0 saying an ascii string follows */
*buf++ = '\0';
avail--;
/* if all data fit into provided SCLP buffer */
if (avail >= cons->iov_sclp_rest) {
/* copy character byte-stream to SCLP buffer */
memcpy(buf, &cons->iov[cons->iov_sclp], cons->iov_sclp_rest);
*size = cons->iov_sclp_rest + 1;
cons->iov_sclp = 0;
cons->iov_bs = 0;
cons->iov_data_len = 0;
cons->iov_sclp_rest = 0;
event->event_pending = false;
/* data provided and no more data pending */
} else {
/* if provided buffer is too small, just copy part */
memcpy(buf, &cons->iov[cons->iov_sclp], avail);
*size = avail + 1;
cons->iov_sclp_rest -= avail;
cons->iov_sclp += avail;
/* more data pending */
}
if (cons->notify) {
cons->notify = false;
qemu_notify_event();
}
}
示例5: nbd_client_closed
static void nbd_client_closed(NBDClient *client)
{
nb_fds--;
if (nb_fds == 0 && !persistent && state == RUNNING) {
state = TERMINATE;
}
qemu_notify_event();
nbd_client_put(client);
}
示例6: nbd_request_put
static void nbd_request_put(NBDRequest *req)
{
NBDClient *client = req->client;
QSIMPLEQ_INSERT_HEAD(&client->exp->requests, req, entry);
if (client->nb_requests-- == MAX_NBD_REQUESTS) {
qemu_notify_event();
}
nbd_client_put(client);
}
示例7: qemu_clock_warp
void qemu_clock_warp(QEMUClock *clock)
{
int64_t deadline;
/*
* There are too many global variables to make the "warp" behavior
* applicable to other clocks. But a clock argument removes the
* need for if statements all over the place.
*/
if (clock != vm_clock || !use_icount) {
return;
}
/*
* If the CPUs have been sleeping, advance the vm_clock timer now. This
* ensures that the deadline for the timer is computed correctly below.
* This also makes sure that the insn counter is synchronized before the
* CPU starts running, in case the CPU is woken by an event other than
* the earliest vm_clock timer.
*/
icount_warp_rt(NULL);
if (!all_cpu_threads_idle() || !qemu_clock_has_timers(vm_clock)) {
qemu_del_timer(icount_warp_timer);
return;
}
if (qtest_enabled()) {
/* When testing, qtest commands advance icount. */
return;
}
vm_clock_warp_start = qemu_get_clock_ns(rt_clock);
deadline = qemu_clock_deadline(vm_clock);
if (deadline > 0) {
/*
* Ensure the vm_clock proceeds even when the virtual CPU goes to
* sleep. Otherwise, the CPU might be waiting for a future timer
* interrupt to wake it up, but the interrupt never comes because
* the vCPU isn't running any insns and thus doesn't advance the
* vm_clock.
*
* An extreme solution for this problem would be to never let VCPUs
* sleep in icount mode if there is a pending vm_clock timer; rather
* time could just advance to the next vm_clock event. Instead, we
* do stop VCPUs and only advance vm_clock after some "real" time,
* (related to the time left until the next event) has passed. This
* rt_clock timer will do this. This avoids that the warps are too
* visible externally---for example, you will not be sending network
* packets continuously instead of every 100ms.
*/
qemu_mod_timer(icount_warp_timer, vm_clock_warp_start + deadline);
} else {
LOGD_CPUS("%s=>qemu_notify_event()\n", __func__);
qemu_notify_event();
}
}
示例8: host_alarm_handler
static void host_alarm_handler(int host_signum)
#endif
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t)
return;
t->expired = true;
t->pending = true;
qemu_notify_event();
}
示例9: host_alarm_handler
static void host_alarm_handler(int host_signum)
#endif
{
//printf("host_alarm_handler\n");
coremu_assert_hw_thr("Host_alarm_handler should be called by hw thr\n");
struct qemu_alarm_timer *t = alarm_timer;
if (!t)
return;
#if 0
#define DISP_FREQ 1000
{
static int64_t delta_min = INT64_MAX;
static int64_t delta_max, delta_cum, last_clock, delta, ti;
static int count;
ti = qemu_get_clock(vm_clock);
if (last_clock != 0) {
delta = ti - last_clock;
if (delta < delta_min)
delta_min = delta;
if (delta > delta_max)
delta_max = delta;
delta_cum += delta;
if (++count == DISP_FREQ) {
printf("timer: min=%" PRId64 " us max=%" PRId64 " us avg=%" PRId64 " us avg_freq=%0.3f Hz\n",
muldiv64(delta_min, 1000000, get_ticks_per_sec()),
muldiv64(delta_max, 1000000, get_ticks_per_sec()),
muldiv64(delta_cum, 1000000 / DISP_FREQ, get_ticks_per_sec()),
(double)get_ticks_per_sec() / ((double)delta_cum / DISP_FREQ));
count = 0;
delta_min = INT64_MAX;
delta_max = 0;
delta_cum = 0;
}
}
last_clock = ti;
}
#endif
if (alarm_has_dynticks(t) ||
(!use_icount &&
qemu_timer_expired(active_timers[QEMU_CLOCK_VIRTUAL],
qemu_get_clock(vm_clock))) ||
qemu_timer_expired(active_timers[QEMU_CLOCK_REALTIME],
qemu_get_clock(rt_clock)) ||
qemu_timer_expired(active_timers[QEMU_CLOCK_HOST],
qemu_get_clock(host_clock))) {
t->expired = alarm_has_dynticks(t);
t->pending = 1;
qemu_notify_event();
}
}
示例10: mm_alarm_handler
static void CALLBACK mm_alarm_handler(UINT uTimerID, UINT uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1,
DWORD_PTR dw2)
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t) {
return;
}
t->expired = true;
t->pending = true;
qemu_notify_event();
}
示例11: qtest_clock_warp
void qtest_clock_warp(int64_t dest)
{
int64_t clock = qemu_get_clock_ns(vm_clock);
assert(qtest_enabled());
while (clock < dest) {
int64_t deadline = qemu_clock_deadline(vm_clock);
int64_t warp = MIN(dest - clock, deadline);
qemu_icount_bias += warp;
qemu_run_timers(vm_clock);
clock = qemu_get_clock_ns(vm_clock);
}
qemu_notify_event();
}
示例12: host_alarm_handler
static void host_alarm_handler(int host_signum)
#endif
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t)
return;
if (alarm_has_dynticks(t) ||
qemu_next_alarm_deadline () <= 0) {
t->expired = alarm_has_dynticks(t);
t->pending = 1;
qemu_notify_event();
}
}
示例13: mm_alarm_handler
static void CALLBACK mm_alarm_handler(UINT uTimerID, UINT uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1,
DWORD_PTR dw2)
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t) {
return;
}
if (alarm_has_dynticks(t) || qemu_next_alarm_deadline() <= 0) {
t->expired = alarm_has_dynticks(t);
t->pending = 1;
qemu_notify_event();
}
}
示例14: mm_alarm_handler
static void CALLBACK mm_alarm_handler(UINT uTimerID, UINT uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1,
DWORD_PTR dw2)
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t) {
return;
}
// We can actually call qemu_next_alarm_deadline() here since this
// doesn't run in a signal handler, but a different thread.
if (alarm_has_dynticks(t) || qemu_next_alarm_deadline() <= 0) {
t->expired = 1;
timer_alarm_pending = 1;
qemu_notify_event();
}
}
示例15: host_alarm_handler
static void host_alarm_handler(int host_signum)
#endif
{
struct qemu_alarm_timer *t = alarm_timer;
if (!t)
return;
#if 0
#define DISP_FREQ 1000
{
static int64_t delta_min = INT64_MAX;
static int64_t delta_max, delta_cum, last_clock, delta, ti;
static int count;
ti = qemu_get_clock_ns(vm_clock);
if (last_clock != 0) {
delta = ti - last_clock;
if (delta < delta_min)
delta_min = delta;
if (delta > delta_max)
delta_max = delta;
delta_cum += delta;
if (++count == DISP_FREQ) {
printf("timer: min=%" PRId64 " us max=%" PRId64 " us avg=%" PRId64 " us avg_freq=%0.3f Hz\n",
muldiv64(delta_min, 1000000, get_ticks_per_sec()),
muldiv64(delta_max, 1000000, get_ticks_per_sec()),
muldiv64(delta_cum, 1000000 / DISP_FREQ, get_ticks_per_sec()),
(double)get_ticks_per_sec() / ((double)delta_cum / DISP_FREQ));
count = 0;
delta_min = INT64_MAX;
delta_max = 0;
delta_cum = 0;
}
}
last_clock = ti;
}
#endif
if (alarm_has_dynticks(t) ||
qemu_next_alarm_deadline () <= 0) {
t->expired = alarm_has_dynticks(t);
t->pending = 1;
qemu_notify_event();
}
}