From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DATE_IN_PAST_96_XX, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFC72C4743C for ; Fri, 4 Jun 2021 16:56:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 403AD613B4 for ; Fri, 4 Jun 2021 16:56:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 403AD613B4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpD7d-0002rd-CM for qemu-devel@archiver.kernel.org; Fri, 04 Jun 2021 12:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpCmc-0004Ru-Hw for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:34:54 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:35679) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpCma-0002cX-Nu for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:34:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=F+zcqFLh8DFiVXFYYi8rgDfObpfpt7catkfkcaYSDRA=; b=W+75G OC319uyuv8AerJXS7QzQUL6L73KXaCCEyXVyDNlrBiERM7B93/audOz6hXziJB+7AY5ZdMjEQWfqP bJkh6gTnF/NyafOrbc75nt6kauOYOX2upt/DUMNh2UjiRi6k9sXlvx6r+sptq8Q/X9yVPdGBcf+mG Le3B/Fo7qZabl4WBt9dxcBODf4CICu36Sk1SswBtxNQ4nh6SdmufLyJw1+aOKu6zRShxPIh4JS7Jy BNj6+d+65QdsTCu9+WyGrg4dsTLzKzMh5lToS1/oKyoTigRO3ow3K2vee0r5zUWK9KnDN6BVEY1Ie mmgcBAnvr5jfFTlI42B75dQlMKMaA==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Thu, 27 May 2021 19:03:17 +0200 Subject: [PATCH v2 2/7] 9pfs: Twalk benchmark To: qemu-devel@nongnu.org Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=e43c658ec76b394005d514034c2defd0eacb7ea0@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch is not intentended to be merged, it just acts as performance A/B comparison benchmark for the subsequent patches. Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 41fed41de1..2cd9e427b4 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -20,6 +20,18 @@ #include "libqos/virtio-9p.h" #include "libqos/qgraph.h" +/* + * to benchmark the real time (not CPU time) that elapsed between start of + * a request and arrival of its response + */ +static double wall_time(void) +{ + struct timeval t; + struct timezone tz; + gettimeofday(&t, &tz); + return t.tv_sec + t.tv_usec * 0.000001; +} + #define QVIRTIO_9P_TIMEOUT_US (10 * 1000 * 1000) static QGuestAllocator *alloc; @@ -646,12 +658,30 @@ static void fs_walk(void *obj, void *data, QGuestAllocator *t_alloc) } do_attach(v9p); + const double start = wall_time(); req = v9fs_twalk(v9p, 0, 1, P9_MAXWELEM, wnames, 0); + const double twalk = wall_time(); v9fs_req_wait_for_reply(req, NULL); + const double waitforreply = wall_time(); v9fs_rwalk(req, &nwqid, &wqid); + const double end = wall_time(); g_assert_cmpint(nwqid, ==, P9_MAXWELEM); + printf("\nTime client spent on sending Twalk: %fs\n\n", + twalk - start); + + printf("Time client spent for waiting for reply from server: %fs " + "[MOST IMPORTANT]\n", waitforreply - start); + printf("(This is the most important value, because it reflects the time\n" + "the 9p server required to process and return the result of the\n" + "Twalk request.)\n\n"); + + printf("Total client time: %fs\n", end - start); + + //printf("Details of response message data: R_readddir nentries=%d " + // "rbytes=%d\n", nentries, count); + for (i = 0; i < P9_MAXWELEM; i++) { g_free(wnames[i]); } -- 2.20.1