make.tmpl: add missing compiler attribute to build_progs
[AROS.git] / test / benchmarks / clib / stdio.c
blob38613906202bd728880f08d009709d05b316ca28
1 /*
2 Copyright © 2008, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "benchmark.h"
7 #include <stdio.h>
9 int main() {
10 FILE *file;
12 if((file = fopen("T:__test__", "w")))
14 #define BUFSIZE 1000000
15 char buffer[BUFSIZE];
17 #define BENCHMARK(z, n, c) fwrite(buffer, BUFSIZE, sizeof(char), file);
18 BENCHMARK_BUFFER(fwrite,100, BUFSIZE);
19 #undef BENCHMARK
21 fseek(file, 0, SEEK_SET);
23 #define BENCHMARK(z, n, c) fread(buffer, BUFSIZE, sizeof(char), file);
24 BENCHMARK_BUFFER(fread,100, BUFSIZE);
25 #undef BENCHMARK
27 fclose(file);
28 remove("T:__test__");
31 if((file = fopen("T:__test__", "w")))
33 char buffer[1];
35 #define BENCHMARK(z, n, c) fwrite(buffer, 1, sizeof(char), file);
36 BENCHMARK_OPERATION(fwrite,10000000);
37 #undef BENCHMARK
39 fseek(file, 0, SEEK_SET);
41 #define BENCHMARK(z, n, c) fread(buffer, 1, sizeof(char), file);
42 BENCHMARK_OPERATION(fread,10000000);
43 #undef BENCHMARK
45 fseek(file, 0, SEEK_SET);
47 #define BENCHMARK(z, n, c) fseek(file, 1, SEEK_CUR);
48 BENCHMARK_OPERATION(fseek_cur,10000);
49 #undef BENCHMARK
51 #define BENCHMARK(z, n, c) fseek(file, c * 100 + n, SEEK_SET);
52 BENCHMARK_OPERATION(fseek_set,10000);
53 #undef BENCHMARK
55 #define BENCHMARK(z, n, c) fseek(file, c * 100 + n, SEEK_END);
56 BENCHMARK_OPERATION(fseek_end,10000);
57 #undef BENCHMARK
59 fclose(file);
60 remove("T:__test__");
63 return 0;