From patchwork Thu Feb 16 12:14:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Barcelo X-Patchwork-Id: 141583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 65414B6F62 for ; Thu, 16 Feb 2012 23:16:58 +1100 (EST) Received: from localhost ([::1]:45447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ry0Gb-0008Pr-SL for incoming@patchwork.ozlabs.org; Thu, 16 Feb 2012 07:16:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:55205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ry0GR-0008ON-UN for qemu-devel@nongnu.org; Thu, 16 Feb 2012 07:16:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ry0GN-0008C3-Sa for qemu-devel@nongnu.org; Thu, 16 Feb 2012 07:16:43 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:48675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ry0GN-0008Bp-J9 for qemu-devel@nongnu.org; Thu, 16 Feb 2012 07:16:39 -0500 Received: by eaac1 with SMTP id c1so827075eaa.4 for ; Thu, 16 Feb 2012 04:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=hMzji9R4kZnz2LrKRn9f1zEtQLBMmI/2UF5a7KWV9hw=; b=hDU5vC5WHDh6ANlpzwL71mN4qP7f2fJnVt+vEklODVT1LabIAsvh83UvYxdlq8LeLJ LBSbvj24AO//NnyDjJj47QfZd8evki8P1nWA7kT2uSiV/7fUJAV4RDwWinIE15ri5sQA 6Fhby2Lguky/ChTpEhtY93LsmenEKgCOT4QjE= Received: by 10.14.183.195 with SMTP id q43mr1408264eem.93.1329394598096; Thu, 16 Feb 2012 04:16:38 -0800 (PST) Received: from localhost.localdomain (62.57.1.36.dyn.user.ono.com. [62.57.1.36]) by mx.google.com with ESMTPS id o49sm22728326eeb.7.2012.02.16.04.16.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Feb 2012 04:16:36 -0800 (PST) From: Alex Barcelo To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2012 13:14:06 +0100 Message-Id: <1329394446-31711-1-git-send-email-abarcelo@ac.upc.edu> X-Mailer: git-send-email 1.7.5.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.173 Cc: Alex Barcelo , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] test-coroutine: add performance test for nesting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The performance test will also check for nesting. It will do a certain quantity of cycles, and each of one will do a depth nesting process. This is useful for benchmarking the creation of coroutines, given that nesting is creation-intensive (and the other perf test does not benchmark that). Signed-off-by: Alex Barcelo --- test-coroutine.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/test-coroutine.c b/test-coroutine.c index bf9f3e9..7425dad 100644 --- a/test-coroutine.c +++ b/test-coroutine.c @@ -177,6 +177,32 @@ static void perf_lifecycle(void) g_test_message("Lifecycle %u iterations: %f s\n", max, duration); } +static void perf_nesting(void) +{ + unsigned int i, maxcycles, maxnesting; + double duration; + + maxcycles = 100000000; + maxnesting = 200000; + Coroutine *root; + NestData nd = { + .n_enter = 0, + .n_return = 0, + .max = maxnesting, + }; + + g_test_timer_start(); + for (i = 0; i < maxcycles; i++) { + root = qemu_coroutine_create(nest); + qemu_coroutine_enter(root, &nd); + } + duration = g_test_timer_elapsed(); + + g_test_message("Nesting %u iterations of %u depth each: %f s\n", + maxcycles, maxnesting, duration); +} + + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -187,6 +213,7 @@ int main(int argc, char **argv) g_test_add_func("/basic/in_coroutine", test_in_coroutine); if (g_test_perf()) { g_test_add_func("/perf/lifecycle", perf_lifecycle); + g_test_add_func("/perf/nesting", perf_nesting); } return g_test_run(); }