From nobody Thu Nov 13 09:11:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1578962036; cv=none; d=zohomail.com; s=zohoarc; b=KxAaY4ZD83G65r0+xL4wRI9oCr9qIiT8rSJW41moZUfTzKKou4nllmgehwCiXcyYxlD5E3q9g9gopOYzNSCXcSyWUFI5Ozi/TllCDWMtqy++Ss3nzl/SKsStwY67LKtuXEe7BpAbEB6MaCYzqZyGECx7ZRjA68Fc/MR22hUzNLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578962036; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+KvNmyLG6kAE2TZaj6MEGe1C+5iebgEtjpC5n6Htklk=; b=DpTU4kRu5/PY6yc+MoAB1FdXCpAPsXuD/N83vTlXb+wZOzNNOe2LFwXQ12dDbW7TXjGBJ4UR4ZDRewLtM96UiECeoqNlXtHUO5Ub7dv8jRxoAX0Ae4tIMWVoZrP3044eybI1CYdyQnuLSdzY2+kNxLqNDeDfZPP+pPpESnEIxps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578962036215650.36396209086; Mon, 13 Jan 2020 16:33:56 -0800 (PST) Received: from localhost ([::1]:57418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irA9b-00061t-3l for importer@patchew.org; Mon, 13 Jan 2020 19:33:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33724) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irA8T-0005Kt-T6 for qemu-devel@nongnu.org; Mon, 13 Jan 2020 19:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irA8S-0007CY-PL for qemu-devel@nongnu.org; Mon, 13 Jan 2020 19:32:45 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:52331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irA8S-0006M1-Ae for qemu-devel@nongnu.org; Mon, 13 Jan 2020 19:32:44 -0500 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=+KvNmyLG6kAE2TZaj6MEGe1C+5iebgEtjpC5n6Htklk=; b=ESqTo qjy6pN/gGpJVw4FuqOimXOp7oSNInl/joGmmsVQouZu1a1Q8gChPSJ6orn19a+VJx7DCZ3lnnl/8L Db9oxb7x/SiE9jC9W7l2dThxcGxMAAkL7tM5LTXbHPRTZoylALNnwepEtojtalcymMDWkY9mjmWY8 RTFZL/CEr3m+Sxx5Vty/TD++XcNJn44Ocot6Cj05E8flhQrSW3MErz3BJ37cHQ5m2P37tBg4F4tfH 96Fx/Q9VPhJVLofA4A4ufU9k3Gz+D7PB/gwsT7tApsm0pwFJvp8bPrlvDmdcT5LgH+FAWO1M7FblM 6/oCjFmxLGJ6wSJjOs7P6k8MR/WNg==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 14 Jan 2020 00:17:26 +0100 Subject: [PATCH v3 11/11] hw/9pfs/9p.c: benchmark time on T_readdir request To: qemu-devel@nongnu.org Cc: Greg Kurz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 91.194.90.13 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch is not intended to be merged, it measures and prints the time the 9p server spends on handling a T_readdir request. It prints the total time it spent on handling the request, and also the time it spent on I/O (fs driver) only. Signed-off-by: Christian Schoenebeck --- hw/9pfs/9p.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 5ebd424af9..7cdf18080f 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2311,6 +2311,15 @@ static void v9fs_free_dirents(struct V9fsDirEnt *e) } } =20 +static double wall_time(void) +{ + struct timeval t; + struct timezone tz; + gettimeofday(&t, &tz); + return t.tv_sec + t.tv_usec * 0.000001; +} + + static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, int32_t max_count) { @@ -2330,6 +2339,8 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, */ const bool dostat =3D pdu->s->ctx.export_flags & V9FS_REMAP_INODES; =20 + const double start =3D wall_time(); + /* * Fetch all required directory entries altogether on a background IO * thread from fs driver. We don't want to do that for each entry @@ -2344,6 +2355,10 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu= , V9fsFidState *fidp, } count =3D 0; =20 + const double end =3D wall_time(); + printf("\n\nTime 9p server spent on synth_readdir() I/O only (synth " + "driver): %fs\n", end - start); + for (struct V9fsDirEnt *e =3D entries; e; e =3D e->next) { dent =3D e->dent; =20 @@ -2416,6 +2431,8 @@ static void coroutine_fn v9fs_readdir(void *opaque) V9fsPDU *pdu =3D opaque; V9fsState *s =3D pdu->s; =20 + const double start =3D wall_time(); + retval =3D pdu_unmarshal(pdu, offset, "dqd", &fid, &initial_offset, &max_count); if (retval < 0) { @@ -2459,6 +2476,10 @@ out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, retval); + + const double end =3D wall_time(); + printf("Time 9p server spent on entire T_readdir request: %fs " + "[IMPORTANT]\n", end - start); } =20 static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp, --=20 2.20.1