diff options
author | Elliott Hughes <enh@google.com> | 2015-01-17 01:24:43 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-17 01:24:44 +0000 |
commit | 3bbf4639080bc2f42435b4a7fd400c44aab7fd70 (patch) | |
tree | 2cf23fe9c573f6f265db968f3569ac952f754289 | |
parent | 481cf21e08a6cbbc686487744f1cb07b6d3f400e (diff) | |
parent | 1cf32f83d3284785c64d3ea66560d23eec915956 (diff) | |
download | android_bionic-3bbf4639080bc2f42435b4a7fd400c44aab7fd70.tar.gz android_bionic-3bbf4639080bc2f42435b4a7fd400c44aab7fd70.tar.bz2 android_bionic-3bbf4639080bc2f42435b4a7fd400c44aab7fd70.zip |
Merge "Add a benchmark for using stdio to read a file in /proc."
-rw-r--r-- | benchmarks/stdio_benchmark.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp index 386ea04c9..fe25d7629 100644 --- a/benchmarks/stdio_benchmark.cpp +++ b/benchmarks/stdio_benchmark.cpp @@ -65,3 +65,13 @@ static void BM_stdio_fwrite_unbuffered(int iters, int chunk_size) { ReadWriteTest(iters, chunk_size, fwrite, false); } BENCHMARK(BM_stdio_fwrite_unbuffered)->AT_COMMON_SIZES; + +static void BM_stdio_fopen_fgets_fclose(int iters) { + char buf[1024]; + for (int i = 0; i < iters; ++i) { + FILE* fp = fopen("/proc/version", "re"); + fgets(buf, sizeof(buf), fp); + fclose(fp); + } +} +BENCHMARK(BM_stdio_fopen_fgets_fclose); |