Add a benchmark for using stdio to read a file in /proc.
Change-Id: I12517aae19e36b7c022a11e8807aece61bb0cb9c
This commit is contained in:
parent
481cf21e08
commit
1cf32f83d3
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue