summaryrefslogtreecommitdiff
path: root/tests/test-coroutine.c
diff options
context:
space:
mode:
authorGabriel Kerneis <gabriel@kerneis.info>2013-09-17 18:26:48 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-19 13:21:41 +0200
commita9031675b9f757eef0fe8c99284ec0133c032c32 (patch)
treed9d0809a1cf1c65b936b4115c5087a57341d2555 /tests/test-coroutine.c
parent2fcd15eac3223b3907837e8d7f2b3829a16a4c45 (diff)
downloadqemu-a9031675b9f757eef0fe8c99284ec0133c032c32.tar.gz
qemu-a9031675b9f757eef0fe8c99284ec0133c032c32.tar.bz2
qemu-a9031675b9f757eef0fe8c99284ec0133c032c32.zip
coroutine: fix /perf/nesting coroutine benchmark
The /perf/nesting benchmark is broken because the counters are not reset after each iteration. Therefore, nesting is done only on the first iteration, and skipped on every other. This patch fixes the issue, and reduces the number of iterations to make it possible to run the benchmark in a reasonable amount of time. Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/test-coroutine.c')
-rw-r--r--tests/test-coroutine.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index 2792191f82..15a885e882 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -182,17 +182,17 @@ static void perf_nesting(void)
unsigned int i, maxcycles, maxnesting;
double duration;
- maxcycles = 100000000;
+ maxcycles = 10000;
maxnesting = 1000;
Coroutine *root;
- NestData nd = {
- .n_enter = 0,
- .n_return = 0,
- .max = maxnesting,
- };
g_test_timer_start();
for (i = 0; i < maxcycles; i++) {
+ NestData nd = {
+ .n_enter = 0,
+ .n_return = 0,
+ .max = maxnesting,
+ };
root = qemu_coroutine_create(nest);
qemu_coroutine_enter(root, &nd);
}