summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-02-08 10:38:21 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-02-08 14:49:17 +0300
commit835b7ee527718e5ba7f9ffb545ee173e098c0b13 (patch)
tree5e67dd70fdc99531b193c0a77b8a74579b7e1fdb
parent91b7cfa7d2c6b799cf84440690293f353a63f139 (diff)
downloadlibatomic_ops-835b7ee527718e5ba7f9ffb545ee173e098c0b13.tar.gz
Rename VERBOSE macro to VERBOSE_STACK in test_stack
(refactoring) * tests/test_stack.c (VERBOSE): Rename to VERBOSE_STACK.
-rw-r--r--tests/test_stack.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/test_stack.c b/tests/test_stack.c
index 17b2843..7c2e667 100644
--- a/tests/test_stack.c
+++ b/tests/test_stack.c
@@ -101,17 +101,16 @@ void add_elements(int n)
AO_stack_push(&the_list, (AO_t *)le);
}
-#ifdef VERBOSE
+#ifdef VERBOSE_STACK
void print_list(void)
{
list_element *p;
for (p = (list_element *)AO_REAL_HEAD_PTR(the_list);
- p != 0;
- p = (list_element *)AO_REAL_NEXT_PTR(p -> next))
+ p != 0; p = (list_element *)AO_REAL_NEXT_PTR(p -> next))
printf("%d\n", p -> data);
}
-#endif /* VERBOSE */
+#endif /* VERBOSE_STACK */
static char marks[MAX_NTHREADS * (MAX_NTHREADS + 1) / 2 + 1];
@@ -181,7 +180,7 @@ volatile AO_t ops_performed = 0;
list_element * t[MAX_NTHREADS + 1];
unsigned index = (unsigned)(size_t)arg;
unsigned i;
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
unsigned j = 0;
printf("starting thread %u\n", index);
@@ -201,11 +200,11 @@ volatile AO_t ops_performed = 0;
{
AO_stack_push(&the_list, (AO_t *)t[i]);
}
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
j += index + 1;
# endif
}
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
printf("finished thread %u: %u total ops\n", index, j);
# endif
return 0;
@@ -258,13 +257,13 @@ int main(int argc, char **argv)
unsigned long start_time;
list_element * le;
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
printf("Before add_elements: exper_n=%d, nthreads=%d,"
" max_nthreads=%d, list_length=%d\n",
exper_n, nthreads, max_nthreads, list_length);
# endif
add_elements(list_length);
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
printf("Initial list (nthreads = %d):\n", nthreads);
print_list();
# endif
@@ -304,7 +303,7 @@ int main(int argc, char **argv)
}
}
times[nthreads][exper_n] = get_msecs() - start_time;
- # ifdef VERBOSE
+ # ifdef VERBOSE_STACK
printf("nthreads=%d, time_ms=%lu\n",
nthreads, times[nthreads][exper_n]);
printf("final list (should be reordered initial list):\n");
@@ -324,7 +323,7 @@ int main(int argc, char **argv)
LIMIT, LIMIT, nthreads);
# ifndef NO_TIMES
for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n) {
-# ifdef VERBOSE
+# ifdef VERBOSE_STACK
printf(" [%lums]", times[nthreads][exper_n]);
# endif
sum += times[nthreads][exper_n];