summaryrefslogtreecommitdiff
path: root/stdio.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-19 22:28:32 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-19 22:28:32 -0400
commit0346d5174eb0ce553cda977d91dd6cf61b7ffe82 (patch)
tree339d9665b997e2c0b8f60fc1c52680635108f86a /stdio.c
downloadlibc-bench-0346d5174eb0ce553cda977d91dd6cf61b7ffe82.tar.gz
initial check-in
Diffstat (limited to 'stdio.c')
-rw-r--r--stdio.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/stdio.c b/stdio.c
new file mode 100644
index 0000000..0d41f86
--- /dev/null
+++ b/stdio.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+size_t b_stdio_putcgetc(void *dummy)
+{
+ FILE *f = tmpfile();
+ size_t i;
+ size_t cs;
+
+ for (i=0; i<5000000; i++)
+ putc('x', f);
+ fseeko(f, 0, SEEK_SET);
+ for (i=0; i<5000000; i++)
+ cs += getc(f);
+ fclose(f);
+
+ return cs;
+}
+
+size_t b_stdio_putcgetc_unlocked(void *dummy)
+{
+ FILE *f = tmpfile();
+ size_t i;
+ size_t cs;
+
+ for (i=0; i<5000000; i++)
+ putc_unlocked('x', f);
+ fseeko(f, 0, SEEK_SET);
+ for (i=0; i<5000000; i++)
+ cs += getc_unlocked(f);
+ fclose(f);
+
+ return cs;
+}