commtech: Add a new calculation method
This calculation performs only a loop and avoid cache pollution
This commit is contained in:
parent
c98db4b4ba
commit
e04818645a
|
@ -33,7 +33,7 @@ CC=gcc
|
||||||
|
|
||||||
# Files
|
# Files
|
||||||
BINNAMES:=asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm
|
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))
|
BINS:=$(patsubst %,$(BINDIR)/%,$(BINNAMES))
|
||||||
CALCLIBS:=$(patsubst %,$(LIBDIR)/$(CALCDIR)/lib%.so.1,$(CALCLIBSNAMES))
|
CALCLIBS:=$(patsubst %,$(LIBDIR)/$(CALCDIR)/lib%.so.1,$(CALCLIBSNAMES))
|
||||||
MAIN_OBJS:=main.o
|
MAIN_OBJS:=main.o
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int nb_loop = 0, prod = 0, *prod_ptr = ∏
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue