[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 9/9] hw/9pfs/9p.c: benchmark time on T_readdir request
From: |
Christian Schoenebeck |
Subject: |
[PATCH v2 9/9] hw/9pfs/9p.c: benchmark time on T_readdir request |
Date: |
Wed, 18 Dec 2019 15:10:46 +0100 |
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 <address@hidden>
---
hw/9pfs/9p.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index a7d36b6350..c6f70b96ee 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2299,6 +2299,15 @@ static void v9fs_free_dirents(struct V9fsDirEnt *e)
}
}
+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)
{
@@ -2318,6 +2327,8 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,
V9fsFidState *fidp,
*/
const bool dostat = pdu->s->ctx.export_flags & V9FS_REMAP_INODES;
+ const double start = 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
@@ -2332,6 +2343,10 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,
V9fsFidState *fidp,
}
count = 0;
+ const double end = wall_time();
+ printf("\n\nTime 9p server spent on synth_readdir() I/O only (synth "
+ "driver): %fs\n", end - start);
+
for (struct V9fsDirEnt *e = entries; e; e = e->next) {
dent = e->dent;
@@ -2404,6 +2419,8 @@ static void coroutine_fn v9fs_readdir(void *opaque)
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
+ const double start = wall_time();
+
retval = pdu_unmarshal(pdu, offset, "dqd", &fid,
&initial_offset, &max_count);
if (retval < 0) {
@@ -2447,6 +2464,10 @@ out:
put_fid(pdu, fidp);
out_nofid:
pdu_complete(pdu, retval);
+
+ const double end = wall_time();
+ printf("Time 9p server spent on entire T_readdir request: %fs "
+ "[IMPORTANT]\n", end - start);
}
static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
--
2.20.1
- [PATCH v2 0/9] 9pfs: readdir optimization, Christian Schoenebeck, 2019/12/18
- [PATCH v2 9/9] hw/9pfs/9p.c: benchmark time on T_readdir request,
Christian Schoenebeck <=
- [PATCH v2 4/9] tests/virtio-9p: added readdir test, Christian Schoenebeck, 2019/12/18
- [PATCH v2 7/9] hw/9pfs/9p-synth: avoid n-square issue in synth_readdir(), Christian Schoenebeck, 2019/12/18
- [PATCH v2 8/9] 9pfs: T_readdir latency optimization, Christian Schoenebeck, 2019/12/18
- [PATCH v2 1/9] tests/virtio-9p: add terminating null in v9fs_string_read(), Christian Schoenebeck, 2019/12/18
- [PATCH v2 2/9] 9pfs: validate count sent by client with T_readdir, Christian Schoenebeck, 2019/12/18
- [PATCH v2 6/9] 9pfs: readdir benchmark, Christian Schoenebeck, 2019/12/18
- [PATCH v2 3/9] hw/9pfs/9p-synth: added directory for readdir test, Christian Schoenebeck, 2019/12/18
- [PATCH v2 5/9] tests/virtio-9p: check file names of R_readdir response, Christian Schoenebeck, 2019/12/18