[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/7] 9pfs: Twalk benchmark
From: |
Christian Schoenebeck |
Subject: |
[PATCH v2 2/7] 9pfs: Twalk benchmark |
Date: |
Thu, 27 May 2021 19:03:17 +0200 |
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
- [PATCH v2 0/7] 9pfs: Twalk optimization, Christian Schoenebeck, 2021/06/04
- Re: [PATCH v2 0/7] 9pfs: Twalk optimization, Greg Kurz, 2021/06/04
- [PATCH v2 2/7] 9pfs: Twalk benchmark,
Christian Schoenebeck <=
- [PATCH v2 6/7] 9pfs: drop root_qid, Christian Schoenebeck, 2021/06/04
- [PATCH v2 4/7] 9pfs: drop fid_to_qid(), Christian Schoenebeck, 2021/06/04
- [PATCH v2 3/7] 9pfs: capture root stat, Christian Schoenebeck, 2021/06/04
- [PATCH v2 7/7] 9pfs: reduce latency of Twalk, Christian Schoenebeck, 2021/06/04
- [PATCH v2 1/7] 9pfs: fix not_same_qid(), Christian Schoenebeck, 2021/06/04
- [PATCH v2 5/7] 9pfs: replace not_same_qid() by same_stat_id(), Christian Schoenebeck, 2021/06/04