From: Anders <mail@flac.kalibalik.dk>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2] Reduce redundant timer rearming
Date: Fri, 14 Dec 2007 00:29:50 +0100 [thread overview]
Message-ID: <4761C06E.60405@flac.kalibalik.dk> (raw)
In-Reply-To: <4761BA27.5020307@flac.kalibalik.dk>
[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]
(resending with the subscribed sender address)
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 99.74 0.012590 1 22766 2706 ioctl
> 0.26 0.000033 0 27044 clock_gettime
> 0.00 0.000000 0 5413 gettimeofday
> 0.00 0.000000 0 5745 select
> 0.00 0.000000 0 2706 rt_sigaction
> 0.00 0.000000 0 8119 5413 rt_sigtimedwait
> 0.00 0.000000 0 5215 timer_settime
> 0.00 0.000000 0 5413 timer_gettime
> ------ ----------- ----------- --------- --------- ----------------
> 100.00 0.012623 82421 8119 total
Here is another patch that implements a dirty bit for the timer lists.
The bit is set when timers are modified or expire. Rearming clears the
bit (and only happens if it is set).
Numbers improve to this:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000013 0 21813 clock_gettime
0.00 0.000000 0 22789 2729 ioctl
0.00 0.000000 0 5459 gettimeofday
0.00 0.000000 0 5790 select
0.00 0.000000 0 2729 rt_sigaction
0.00 0.000000 0 8188 5459 rt_sigtimedwait
0.00 0.000000 0 2729 timer_settime
0.00 0.000000 0 2752 timer_gettime
------ ----------- ----------- --------- --------- ----------------
100.00 0.000013 72249 8188 total
I am not so sure about this one, so comments are appreciated.
Best regards,
Anders.
[-- Attachment #2: qemu-rearm-when-modified.diff --]
[-- Type: text/x-patch, Size: 1186 bytes --]
diff --git a/qemu/vl.c b/qemu/vl.c
index 2cd580d..924736e 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -816,6 +816,7 @@ struct qemu_alarm_timer {
};
#define ALARM_FLAG_DYNTICKS 0x1
+#define ALARM_FLAG_MODIFIED 0x2
static inline int alarm_has_dynticks(struct qemu_alarm_timer *t)
{
@@ -827,6 +828,11 @@ static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t)
if (!alarm_has_dynticks(t))
return;
+ if (!(t->flags & ALARM_FLAG_MODIFIED))
+ return;
+
+ t->flags &= ~(ALARM_FLAG_MODIFIED);
+
t->rearm(t);
}
@@ -989,6 +995,8 @@ void qemu_del_timer(QEMUTimer *ts)
{
QEMUTimer **pt, *t;
+ alarm_timer->flags |= ALARM_FLAG_MODIFIED;
+
/* NOTE: this code must be signal safe because
qemu_timer_expired() can be called from a signal. */
pt = &active_timers[ts->clock->type];
@@ -1182,6 +1190,7 @@ static void host_alarm_handler(int host_signum)
#endif
CPUState *env = cpu_single_env;
if (env) {
+ alarm_timer->flags |= ALARM_FLAG_MODIFIED;
/* stop the currently executing cpu because a timer occured */
cpu_interrupt(env, CPU_INTERRUPT_EXIT);
#ifdef USE_KQEMU
next prev parent reply other threads:[~2007-12-13 23:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 23:03 [Qemu-devel] [PATCH] Reduce redundant timer rearming Anders
2007-12-13 23:17 ` Anders Melchiorsen
2007-12-13 23:29 ` Anders [this message]
2007-12-14 0:05 ` [Qemu-devel] [PATCH 3] " Anders
2007-12-16 15:46 ` [Qemu-devel] [PATCH 4] " Anders
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4761C06E.60405@flac.kalibalik.dk \
--to=mail@flac.kalibalik.dk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.