From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: [PATCH v2 2/7] 9pfs: Twalk benchmark
Date: Thu, 27 May 2021 19:03:17 +0200 [thread overview]
Message-ID: <e43c658ec76b394005d514034c2defd0eacb7ea0.1622821729.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1622821729.git.qemu_oss@crudebyte.com>
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 <qemu_oss@crudebyte.com>
---
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
next prev parent reply other threads:[~2021-06-04 16:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 15:48 [PATCH v2 0/7] 9pfs: Twalk optimization Christian Schoenebeck
2021-05-27 17:03 ` Christian Schoenebeck [this message]
2021-05-27 17:04 ` [PATCH v2 3/7] 9pfs: capture root stat Christian Schoenebeck
2021-06-04 14:46 ` [PATCH v2 1/7] 9pfs: fix not_same_qid() Christian Schoenebeck
2021-06-04 15:13 ` [PATCH v2 4/7] 9pfs: drop fid_to_qid() Christian Schoenebeck
2021-06-04 15:21 ` [PATCH v2 5/7] 9pfs: replace not_same_qid() by same_stat_id() Christian Schoenebeck
2021-06-04 15:32 ` [PATCH v2 6/7] 9pfs: drop root_qid Christian Schoenebeck
2021-06-04 15:38 ` [PATCH v2 7/7] 9pfs: reduce latency of Twalk Christian Schoenebeck
2021-07-02 14:36 ` Greg Kurz
2021-07-02 15:05 ` Christian Schoenebeck
2021-07-02 15:26 ` Greg Kurz
2021-06-04 16:31 ` [PATCH v2 0/7] 9pfs: Twalk optimization Greg Kurz
2021-06-04 18:23 ` Christian Schoenebeck
2021-06-28 10:20 ` Christian Schoenebeck
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=e43c658ec76b394005d514034c2defd0eacb7ea0.1622821729.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--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).