Explain the stdio benchmark's read/write results.
Specifically: this benchmark tests stdio overhead, not kernel/fs
performance.
Bug: http://b/389866703
Change-Id: I314d5eb9514c74f2855ba6f5fbb1298814a99c7e
diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp
index 03f3f29..f9ceb4c 100644
--- a/benchmarks/stdio_benchmark.cpp
+++ b/benchmarks/stdio_benchmark.cpp
@@ -38,6 +38,13 @@
void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) {
size_t chunk_size = state.range(0);
+ // /dev/zero copies zeroes if you read from it and discards writes.
+ //
+ // This is fine for the purpose of measuring stdio overhead
+ // rather than kernel/fs performance.
+ // (Old versions of stdio would copy reads/writes larger than
+ // the stdio buffer through the stdio buffer in chunks,
+ // rather than directly to the user's destination.)
FILE* fp = fopen("/dev/zero", "r+e");
__fsetlocking(fp, FSETLOCKING_BYCALLER);
char* buf = new char[chunk_size];