From 483210ac35bec5c30d787c79fb0de240a4204a82 Mon Sep 17 00:00:00 2001 From: Laurent MAZET Date: Wed, 15 Oct 2025 19:28:03 +0200 Subject: [PATCH] clean tests --- clock.c | 7 +------ cycle.c | 7 +------ thread_c+j.c | 7 +------ thread_c.c | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/clock.c b/clock.c index f21e5b7..5da792c 100644 --- a/clock.c +++ b/clock.c @@ -14,7 +14,6 @@ dts_t *deltas = NULL; int nb_measurements = 0; -pthread_mutex_t *mutex = NULL; char *message = "Clock accurency"; void (*usage_ext) (FILE *) = NULL; @@ -26,14 +25,13 @@ int rc = 0; #define MAXDUR 1000 #define MINDUR 100 -int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) +int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro) { /* set global variables */ deltas = buffer; nb_measurements = nb; - mutex = synchro; return 0; } @@ -41,8 +39,6 @@ int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) void *ping (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); - for (int i = 0; i < nb_measurements; i++) { int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX); @@ -59,7 +55,6 @@ void *ping (__attribute__((unused)) void *arg) void *pong (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); pthread_exit (NULL); } diff --git a/cycle.c b/cycle.c index bd3c484..f81c7ab 100644 --- a/cycle.c +++ b/cycle.c @@ -14,7 +14,6 @@ dts_t *deltas = NULL; int nb_measurements = 0; -pthread_mutex_t *mutex = NULL; char *message = "Cycle latency"; void (*usage_ext) (FILE *) = NULL; @@ -26,14 +25,13 @@ int rc = 0; #define MAXDUR 1000 #define MINDUR 100 -int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) +int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro) { /* set global variables */ deltas = buffer; nb_measurements = nb; - mutex = synchro; return 0; } @@ -41,8 +39,6 @@ int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) void *ping (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); - for (int i = 0; i < nb_measurements; i++) { int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX); @@ -59,7 +55,6 @@ void *ping (__attribute__((unused)) void *arg) void *pong (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); pthread_exit (NULL); } diff --git a/thread_c+j.c b/thread_c+j.c index 5b752b0..179c834 100644 --- a/thread_c+j.c +++ b/thread_c+j.c @@ -12,7 +12,6 @@ dts_t *deltas = NULL; int nb_measurements = 0; -pthread_mutex_t *mutex = NULL; char *message = "Thread (create and join) latency"; void (*usage_ext) (FILE *) = NULL; @@ -20,14 +19,13 @@ int (*parse_arg_ext) (char *) = NULL; int rc = 0; -int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) +int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro) { /* set global variables */ deltas = buffer; nb_measurements = nb; - mutex = synchro; return 0; } @@ -40,8 +38,6 @@ void* dummy_thread (__attribute__((unused)) void *arg) void *ping (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); - for (int i = 0; i < nb_measurements; i++) { ts_t ts1; @@ -67,7 +63,6 @@ void *ping (__attribute__((unused)) void *arg) void *pong (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); pthread_exit (NULL); } diff --git a/thread_c.c b/thread_c.c index 637c526..573b072 100644 --- a/thread_c.c +++ b/thread_c.c @@ -12,7 +12,6 @@ dts_t *deltas = NULL; int nb_measurements = 0; -pthread_mutex_t *mutex = NULL; char *message = "Thread (create) latency"; void (*usage_ext) (FILE *) = NULL; @@ -21,14 +20,13 @@ int (*parse_arg_ext) (char *) = NULL; ts_t ts1, ts2; int rc = 0; -int init (dts_t *buffer, int nb, pthread_mutex_t *synchro) +int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro) { /* set global variables */ deltas = buffer; nb_measurements = nb; - mutex = synchro; return 0; } @@ -42,8 +40,6 @@ void* dummy_thread (__attribute__((unused)) void *arg) void *ping (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); - for (int i = 0; i < nb_measurements; i++) { sys_timestamp (&ts1); @@ -65,7 +61,6 @@ void *ping (__attribute__((unused)) void *arg) void *pong (__attribute__((unused)) void *arg) { - pthread_mutex_unlock (mutex); pthread_exit (NULL); } -- 2.30.2