From f5039ce66bf8d9a7e9fa4ca442ca2039c0be7278 Mon Sep 17 00:00:00 2001 From: Nemo D'ACREMONT Date: Fri, 14 Mar 2025 18:00:06 +0100 Subject: [PATCH] update: update tests --- tst/21-create-many.c | 1 + tst/22-create-many-recursive.c | 1 + tst/23-create-many-once.c | 1 + tst/31-switch-many.c | 1 + tst/32-switch-many-join.c | 10 +++++----- tst/33-switch-many-cascade.c | 1 + tst/51-fibonacci.c | 2 ++ tst/61-mutex.c | 1 + tst/62-mutex.c | 1 + 9 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tst/21-create-many.c b/tst/21-create-many.c index ed941dc..cb82ee7 100644 --- a/tst/21-create-many.c +++ b/tst/21-create-many.c @@ -48,5 +48,6 @@ int main(int argc, char *argv[]) gettimeofday(&tv2, NULL); us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); printf("%d threads créés et détruits séquentiellement en %lu us\n", nb, us); + printf("GRAPH;21;%d;%lu\n", nb, us); return 0; } diff --git a/tst/22-create-many-recursive.c b/tst/22-create-many-recursive.c index 4719174..ec00b4f 100644 --- a/tst/22-create-many-recursive.c +++ b/tst/22-create-many-recursive.c @@ -50,5 +50,6 @@ int main(int argc, char *argv[]) gettimeofday(&tv2, NULL); us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); printf("%ld threads créés et détruits récursivement en %lu us\n", nb, us); + printf("GRAPH;22;%ld;%lu\n", nb, us); return 0; } diff --git a/tst/23-create-many-once.c b/tst/23-create-many-once.c index 99fe91e..d430fd0 100644 --- a/tst/23-create-many-once.c +++ b/tst/23-create-many-once.c @@ -67,5 +67,6 @@ int main(int argc, char *argv[]) free(th); printf("%d threads créés et détruits tous d'un coup en %lu us\n", nb, us); + printf("GRAPH;23;%d;%lu\n", nb, us); return 0; } diff --git a/tst/31-switch-many.c b/tst/31-switch-many.c index dc40958..eb04fa2 100644 --- a/tst/31-switch-many.c +++ b/tst/31-switch-many.c @@ -66,6 +66,7 @@ int main(int argc, char *argv[]) us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); printf("%d yield avec %d threads: %ld us\n", nbyield, nbth, us); + printf("GRAPH;31;%d;%d;%lu\n", nbyield, nbth, us); free(ths); diff --git a/tst/32-switch-many-join.c b/tst/32-switch-many-join.c index d69a027..5a0afc3 100644 --- a/tst/32-switch-many-join.c +++ b/tst/32-switch-many-join.c @@ -16,6 +16,7 @@ * - thread_join() avec récupération de la valeur de retour */ +static unsigned long nbthrd; static int nbyield; static void * thfunc(void *_nbth) @@ -41,24 +42,23 @@ static void * thfunc(void *_nbth) us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); printf("%d yield avec plein de threads dans join: %ld us\n", nbyield, us); + printf("GRAPH;32;%ld;%d;%lu\n", nbthrd, nbyield, us); } return _nbth; } int main(int argc, char *argv[]) { - unsigned long nbth; - if (argc < 3) { printf("arguments manquants: nombre de threads, puis nombre de yield\n"); return -1; } - nbth = atoi(argv[1]); + nbthrd = atoi(argv[1]); nbyield = atoi(argv[2]); - thfunc((void*) nbth); + thfunc((void*) nbthrd); - printf("%ld threads créés et détruits\n", nbth); + printf("%ld threads créés et détruits\n", nbthrd); return 0; } diff --git a/tst/33-switch-many-cascade.c b/tst/33-switch-many-cascade.c index ed6dc47..25498f2 100644 --- a/tst/33-switch-many-cascade.c +++ b/tst/33-switch-many-cascade.c @@ -70,5 +70,6 @@ int main(int argc, char *argv[]) printf("%d yield avec plein de threads dans join: %ld us\n", nbyield, us); printf("%ld threads créés et détruits\n", nbth); + printf("GRAPH;33;%ld;%d;%lu\n", nbth, nbyield, us); return 0; } diff --git a/tst/51-fibonacci.c b/tst/51-fibonacci.c index 66d10bd..aabe938 100644 --- a/tst/51-fibonacci.c +++ b/tst/51-fibonacci.c @@ -80,9 +80,11 @@ int main(int argc, char *argv[]) if (res != fibo_checker(value)) { printf("fibo(%lu) != %lu (FAILED)\n", value, fibo_checker(value)); + printf("GRAPH;%lu;%lu;%e;%s\n", value, res, s, "FAILED" ); return EXIT_FAILURE; } else { printf("fibo(%lu) = %lu en %e s\n", value, res, s ); + printf("GRAPH;%lu;%lu;%e;%s\n", value, res, s, "SUCCESS" ); return EXIT_SUCCESS; } } diff --git a/tst/61-mutex.c b/tst/61-mutex.c index 95c4483..9278056 100644 --- a/tst/61-mutex.c +++ b/tst/61-mutex.c @@ -95,6 +95,7 @@ int main(int argc, char *argv[]) if ( counter == ( nb * 1000 ) ) { printf("La somme a été correctement calculée (%d * 1000 = %d) en %ld us\n", nb, counter, us); + printf("GRAPH;61;%d;%ld\n", nb, us ); return EXIT_SUCCESS; } else { diff --git a/tst/62-mutex.c b/tst/62-mutex.c index daa6f1c..4596484 100644 --- a/tst/62-mutex.c +++ b/tst/62-mutex.c @@ -117,6 +117,7 @@ int main(int argc, char *argv[]) if(err == EXIT_SUCCESS) { us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); printf("Programme exécuté en %ld us\n", us); + printf("GRAPH;62;%d;%ld\n", nb, us ); } return err; }