commtech: Add a new calculation method

This calculation performs only a loop and avoid cache pollution
This commit is contained in:
Thomas Preud'homme 2009-06-30 22:37:55 +02:00 committed by Thomas Preud'homme
parent c98db4b4ba
commit e04818645a
2 changed files with 28 additions and 1 deletions

View File

@ -33,7 +33,7 @@ CC=gcc
# Files
BINNAMES:=asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm
CALCLIBSNAMES:=calc_mat
CALCLIBSNAMES:=calc_mat calc_useless_loop
BINS:=$(patsubst %,$(BINDIR)/%,$(BINNAMES))
CALCLIBS:=$(patsubst %,$(LIBDIR)/$(CALCDIR)/lib%.so.1,$(CALCLIBSNAMES))
MAIN_OBJS:=main.o

View File

@ -0,0 +1,27 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
static int nb_loop = 0, prod = 0, *prod_ptr = &prod;
int init_calc(int param_nb_loop)
{
nb_loop = param_nb_loop;
srand((unsigned int) time(NULL));
return 0;
}
void **do_calc(void)
{
int i;
for(i = 0; i < nb_loop; i++)
prod += rand();
return (void **) &prod_ptr;
}
int end_calc(void)
{
return 0;
}