move c benchmarks to own directory
This commit is contained in:
27
test/bench/c/adds.c
Normal file
27
test/bench/c/adds.c
Normal 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
19
test/bench/c/calls.c
Normal 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
9
test/bench/c/hello.c
Normal 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
11
test/bench/c/itos.c
Normal 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
9
test/bench/c/null.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter = 98304 + 1696;
|
||||
while(counter--) {
|
||||
counter = counter;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user