From 1a866b73731ce58b0ba31d80a2a84c84737c7d30 Mon Sep 17 00:00:00 2001
From: Jakob Unterwurzacher
Date: Fri, 12 May 2023 09:55:54 +0200
Subject: canonical-benchmarks.bash: drop page cache of "zero" file

For the streaming read benchmark, we don't want to benchmark
the page cache.
---
 tests/canonical-benchmarks.bash | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/canonical-benchmarks.bash b/tests/canonical-benchmarks.bash
index 195effe..4c1a357 100755
--- a/tests/canonical-benchmarks.bash
+++ b/tests/canonical-benchmarks.bash
@@ -35,7 +35,13 @@ function etime {
 }
 
 echo -n "WRITE: "
-dd if=/dev/zero of=zero bs=131072 count=2000 2>&1 | tail -n 1
+dd if=/dev/zero of=zero bs=131072 count=2000 conv=fsync 2>&1 | tail -n 1
+
+# Drop cache of file "zero", otherwise we are benchmarking the
+# page cache. Borrowed from
+# https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html#index-nocache
+dd if=zero iflag=nocache count=0 status=none
+
 sleep 0.1
 echo -n "READ:  "
 dd if=zero of=/dev/null bs=131072 count=2000 2>&1 | tail -n 1
-- 
cgit v1.2.3