From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Blue Swirl <blauwirbel@gmail.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v5 5/5] coroutine: add check-coroutine --benchmark-lifecycle
Date: Sun, 12 Jun 2011 21:46:25 +0100 [thread overview]
Message-ID: <1307911585-22106-6-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1307911585-22106-1-git-send-email-stefanha@linux.vnet.ibm.com>
Add a microbenchmark for coroutine create, enter, and return (aka
lifecycle). This is a useful benchmark because users are expected to
create many coroutines, one per I/O request for example, and we
therefore need to provide good performance in that scenario.
To run:
make check-coroutine
./check-coroutine --benchmark-lifecycle 20000000
This will do 20,000,000 coroutine create, enter, return iterations and
print the resulting time.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
test-coroutine.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/test-coroutine.c b/test-coroutine.c
index 9e9d3c9..bf9f3e9 100644
--- a/test-coroutine.c
+++ b/test-coroutine.c
@@ -150,6 +150,33 @@ static void test_lifecycle(void)
g_assert(done); /* expect done to be true (second time) */
}
+/*
+ * Lifecycle benchmark
+ */
+
+static void coroutine_fn empty_coroutine(void *opaque)
+{
+ /* Do nothing */
+}
+
+static void perf_lifecycle(void)
+{
+ Coroutine *coroutine;
+ unsigned int i, max;
+ double duration;
+
+ max = 1000000;
+
+ g_test_timer_start();
+ for (i = 0; i < max; i++) {
+ coroutine = qemu_coroutine_create(empty_coroutine);
+ qemu_coroutine_enter(coroutine, NULL);
+ }
+ duration = g_test_timer_elapsed();
+
+ g_test_message("Lifecycle %u iterations: %f s\n", max, duration);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -158,5 +185,8 @@ int main(int argc, char **argv)
g_test_add_func("/basic/nesting", test_nesting);
g_test_add_func("/basic/self", test_self);
g_test_add_func("/basic/in_coroutine", test_in_coroutine);
+ if (g_test_perf()) {
+ g_test_add_func("/perf/lifecycle", perf_lifecycle);
+ }
return g_test_run();
}
--
1.7.5.3
next prev parent reply other threads:[~2011-06-12 20:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-12 20:46 [Qemu-devel] [PATCH v5 0/5] Coroutines for better asynchronous programming Stefan Hajnoczi
2011-06-12 20:46 ` [Qemu-devel] [PATCH v5 1/5] Add hard build dependency on glib Stefan Hajnoczi
2011-06-18 16:15 ` Andreas Färber
2011-06-18 17:21 ` Stefan Hajnoczi
2011-06-18 19:44 ` Andreas Färber
2011-06-18 20:46 ` Stefan Hajnoczi
2011-06-18 21:29 ` Andreas Färber
2011-06-25 14:02 ` Andreas Färber
2011-06-12 20:46 ` [Qemu-devel] [PATCH v5 2/5] coroutine: introduce coroutines Stefan Hajnoczi
2011-06-25 14:03 ` Andreas Färber
2011-06-25 16:50 ` Andreas Färber
2011-06-12 20:46 ` [Qemu-devel] [PATCH v5 3/5] coroutine: implement coroutines using gthread Stefan Hajnoczi
2011-06-25 17:03 ` Andreas Färber
2011-06-30 0:51 ` Alexandre Raymond
2011-06-12 20:46 ` [Qemu-devel] [PATCH v5 4/5] coroutine: add check-coroutine automated tests Stefan Hajnoczi
2011-06-25 14:11 ` Andreas Färber
2011-06-25 14:27 ` Andreas Färber
2011-06-25 15:39 ` Andreas Färber
2011-06-12 20:46 ` Stefan Hajnoczi [this message]
2011-06-21 13:26 ` [Qemu-devel] [PATCH v5 0/5] Coroutines for better asynchronous programming Stefan Hajnoczi
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=1307911585-22106-6-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=jvrao@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).