move c benchmarks to own directory

This commit is contained in:
Torsten Ruger
2015-11-21 14:22:53 +02:00
parent d0b655d05f
commit 9eab4b7f67
5 changed files with 0 additions and 0 deletions

27
test/bench/c/adds.c Normal file
View File

@ -0,0 +1,27 @@
#include<stdio.h>
int fibo(int n){
int result;
int a = 0;
int b = 1;
int i = 1;
while( i < n )
{
result = a + b;
a = b;
b = result;
i++;
}
return result;
}
int main(void)
{
int counter = 98304 + 1696;
int counter2 = counter;
int level = 40;
int fib ;
while(counter--) {
fib = fibo(level);
}
}

19
test/bench/c/calls.c Normal file
View File

@ -0,0 +1,19 @@
#include<stdio.h>
int fibo_r(int n)
{
if ( n < 2 )
return n;
else
return ( fibo_r(n-1) + fibo_r(n-2) );
}
int main(void)
{
int counter = 1000;
int counter2 = counter;
int fib ;
while(counter--) {
fib = fibo_r(20);
}
}

9
test/bench/c/hello.c Normal file
View File

@ -0,0 +1,9 @@
#include<stdio.h>
int main(void)
{
int counter = 98304 + 1696;
while(counter--) {
printf("Hello there\n");
}
}

11
test/bench/c/itos.c Normal file
View File

@ -0,0 +1,11 @@
#include<stdio.h>
int main(void)
{
char stringa[20] ;
int counter = 98304 + 1696;
while(counter--) {
sprintf(stringa, "%i\n" , counter);
}
}

9
test/bench/c/null.c Normal file
View File

@ -0,0 +1,9 @@
#include<stdio.h>
int main(void)
{
int counter = 98304 + 1696;
while(counter--) {
counter = counter;
}
}