commtechs bench: calculation init takes an arg
This commit is contained in:
parent
f4b3904541
commit
a590ecca09
|
@ -7,12 +7,14 @@
|
||||||
|
|
||||||
static int *mat, *vect;
|
static int *mat, *vect;
|
||||||
static int li;
|
static int li;
|
||||||
static int n = 16, m = 16; /* Size of the matrice: n lines, m columns */
|
static int n, m; /* Size of the matrice: n lines, m columns */
|
||||||
|
|
||||||
void init_calc(void)
|
void init_calc(int size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
n = size;
|
||||||
|
m = size;
|
||||||
srand(42);
|
srand(42);
|
||||||
mat = (int *) malloc(n * m * sizeof(int));
|
mat = (int *) malloc(n * m * sizeof(int));
|
||||||
vect = (int *) malloc(m * sizeof(int));
|
vect = (int *) malloc(m * sizeof(int));
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
|
|
||||||
#define toString(x) doStringification(x)
|
#define toString(x) doStringification(x)
|
||||||
#define doStringification(x) #x
|
#define doStringification(x) #x
|
||||||
|
#define INIT_CALC_ARG 16
|
||||||
|
|
||||||
|
|
||||||
static long nb_bufs_sent = 0;
|
static long nb_bufs_sent = 0;
|
||||||
long nb_prod = 0;
|
long nb_prod = 0;
|
||||||
static void (*init_calc)(void) = NULL;
|
static void (*init_calc)(int) = NULL;
|
||||||
static void *(*do_calc)(void) = NULL;
|
static void *(*do_calc)(void) = NULL;
|
||||||
static void (*end_calc)(void) = NULL;
|
static void (*end_calc)(void) = NULL;
|
||||||
static int shared = 0;
|
static int shared = 0;
|
||||||
|
@ -49,7 +50,7 @@ void usage(char *argv[])
|
||||||
printf("%s\n", options);
|
printf("%s\n", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_nothing(void)
|
void do_noinit(int unused)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +61,10 @@ void *do_nocalc(void)
|
||||||
return &an_int;
|
return &an_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void do_noend(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int analyse_options(int argc, char *argv[])
|
int analyse_options(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
@ -162,9 +167,9 @@ int analyse_options(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if (do_calc == NULL)
|
if (do_calc == NULL)
|
||||||
{
|
{
|
||||||
init_calc = do_nothing;
|
init_calc = do_noinit;
|
||||||
do_calc = do_nocalc;
|
do_calc = do_nocalc;
|
||||||
end_calc = do_nothing;
|
end_calc = do_noend;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +207,7 @@ void *producer(void *unused)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init_calc();
|
init_calc(INIT_CALC_ARG);
|
||||||
if (initialize_papi() != -1)
|
if (initialize_papi() != -1)
|
||||||
{
|
{
|
||||||
for(i = 0; i < nb_bufs_sent; i++) {
|
for(i = 0; i < nb_bufs_sent; i++) {
|
||||||
|
|
Loading…
Reference in New Issue