canonical-benchmarks.bash: drop page cache of "zero" file

For the streaming read benchmark, we don't want to benchmark
the page cache.
This commit is contained in:
Jakob Unterwurzacher 2023-05-12 09:55:54 +02:00
parent aa1d8a0f90
commit 1a866b7373

View File

@ -35,7 +35,13 @@ function etime {
} }
echo -n "WRITE: " 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 sleep 0.1
echo -n "READ: " echo -n "READ: "
dd if=zero of=/dev/null bs=131072 count=2000 2>&1 | tail -n 1 dd if=zero of=/dev/null bs=131072 count=2000 2>&1 | tail -n 1