Skip to content
Snippets Groups Projects
Commit 958dd5c1 authored by ylvse560's avatar ylvse560
Browse files

Better variable names

parent bc1458cf
Branches
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ assert_fun(int expr, const char *str, const char *file, const char* function, si ...@@ -84,7 +84,7 @@ assert_fun(int expr, const char *str, const char *file, const char* function, si
stack_t *stack; stack_t *stack;
data_t data; data_t data;
stack_t *empty_stacks[NB_THREADS]; stack_t *free_stacks[NB_THREADS];
#if MEASURE != 0 #if MEASURE != 0
struct stack_measure_arg struct stack_measure_arg
...@@ -106,7 +106,7 @@ stack_measure_pop(void* arg) ...@@ -106,7 +106,7 @@ stack_measure_pop(void* arg)
for (i = 0; i < MAX_PUSH_POP / NB_THREADS; i++) for (i = 0; i < MAX_PUSH_POP / NB_THREADS; i++)
{ {
// See how fast your implementation can pop MAX_PUSH_POP elements in parallel // See how fast your implementation can pop MAX_PUSH_POP elements in parallel
stack_pop(stack, empty_stacks[args->id]); stack_pop(stack, free_stacks[args->id]);
} }
clock_gettime(CLOCK_MONOTONIC, &t_stop[args->id]); clock_gettime(CLOCK_MONOTONIC, &t_stop[args->id]);
...@@ -123,7 +123,7 @@ stack_measure_push(void* arg) ...@@ -123,7 +123,7 @@ stack_measure_push(void* arg)
for (i = 0; i < MAX_PUSH_POP / NB_THREADS; i++) for (i = 0; i < MAX_PUSH_POP / NB_THREADS; i++)
{ {
// See how fast your implementation can push MAX_PUSH_POP elements in parallel // See how fast your implementation can push MAX_PUSH_POP elements in parallel
stack_push(stack, empty_stacks[args->id], i); stack_push(stack, free_stacks[args->id], i);
} }
clock_gettime(CLOCK_MONOTONIC, &t_stop[args->id]); clock_gettime(CLOCK_MONOTONIC, &t_stop[args->id]);
...@@ -159,12 +159,12 @@ test_setup() ...@@ -159,12 +159,12 @@ test_setup()
//Allocate memory for many stacks //Allocate memory for many stacks
for(int i = 0; i < NB_THREADS; i++) for(int i = 0; i < NB_THREADS; i++)
{ {
empty_stacks[i] = malloc(sizeof(stack_t)); free_stacks[i] = malloc(sizeof(stack_t));
#if MEASURE == 1 #if MEASURE == 1
stack_init(empty_stacks[i], 0); stack_init(free_stacks[i], 0);
#else #else
stack_init(empty_stacks[i], MAX_PUSH_POP/NB_THREADS); stack_init(free_stacks[i], MAX_PUSH_POP/NB_THREADS);
#endif #endif
} }
} }
...@@ -178,8 +178,8 @@ test_teardown() ...@@ -178,8 +178,8 @@ test_teardown()
for(int i = 0; i < NB_THREADS; i++) for(int i = 0; i < NB_THREADS; i++)
{ {
free_nodes(empty_stacks[i]); free_nodes(free_stacks[i]);
free(empty_stacks[i]); free(free_stacks[i]);
} }
free_nodes(stack); free_nodes(stack);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment