update: update tests

This commit is contained in:
Nemo D'ACREMONT 2025-03-14 18:00:06 +01:00
parent 51c1f319a0
commit f5039ce66b
No known key found for this signature in database
GPG Key ID: 85F245EC3BB1E022
9 changed files with 14 additions and 5 deletions

View File

@ -48,5 +48,6 @@ int main(int argc, char *argv[])
gettimeofday(&tv2, NULL); gettimeofday(&tv2, NULL);
us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); 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("%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; return 0;
} }

View File

@ -50,5 +50,6 @@ int main(int argc, char *argv[])
gettimeofday(&tv2, NULL); gettimeofday(&tv2, NULL);
us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); 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("%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; return 0;
} }

View File

@ -67,5 +67,6 @@ int main(int argc, char *argv[])
free(th); free(th);
printf("%d threads créés et détruits tous d'un coup en %lu us\n", nb, us); 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; return 0;
} }

View File

@ -66,6 +66,7 @@ int main(int argc, char *argv[])
us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec);
printf("%d yield avec %d threads: %ld us\n", printf("%d yield avec %d threads: %ld us\n",
nbyield, nbth, us); nbyield, nbth, us);
printf("GRAPH;31;%d;%d;%lu\n", nbyield, nbth, us);
free(ths); free(ths);

View File

@ -16,6 +16,7 @@
* - thread_join() avec récupération de la valeur de retour * - thread_join() avec récupération de la valeur de retour
*/ */
static unsigned long nbthrd;
static int nbyield; static int nbyield;
static void * thfunc(void *_nbth) 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); 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", printf("%d yield avec plein de threads dans join: %ld us\n",
nbyield, us); nbyield, us);
printf("GRAPH;32;%ld;%d;%lu\n", nbthrd, nbyield, us);
} }
return _nbth; return _nbth;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
unsigned long nbth;
if (argc < 3) { if (argc < 3) {
printf("arguments manquants: nombre de threads, puis nombre de yield\n"); printf("arguments manquants: nombre de threads, puis nombre de yield\n");
return -1; return -1;
} }
nbth = atoi(argv[1]); nbthrd = atoi(argv[1]);
nbyield = atoi(argv[2]); 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; return 0;
} }

View File

@ -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("%d yield avec plein de threads dans join: %ld us\n", nbyield, us);
printf("%ld threads créés et détruits\n", nbth); printf("%ld threads créés et détruits\n", nbth);
printf("GRAPH;33;%ld;%d;%lu\n", nbth, nbyield, us);
return 0; return 0;
} }

View File

@ -80,9 +80,11 @@ int main(int argc, char *argv[])
if (res != fibo_checker(value)) { if (res != fibo_checker(value)) {
printf("fibo(%lu) != %lu (FAILED)\n", value, 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; return EXIT_FAILURE;
} else { } else {
printf("fibo(%lu) = %lu en %e s\n", value, res, s ); 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; return EXIT_SUCCESS;
} }
} }

View File

@ -95,6 +95,7 @@ int main(int argc, char *argv[])
if ( counter == ( nb * 1000 ) ) { if ( counter == ( nb * 1000 ) ) {
printf("La somme a été correctement calculée (%d * 1000 = %d) en %ld us\n", nb, counter, us); 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; return EXIT_SUCCESS;
} }
else { else {

View File

@ -117,6 +117,7 @@ int main(int argc, char *argv[])
if(err == EXIT_SUCCESS) { if(err == EXIT_SUCCESS) {
us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec); us = (tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec);
printf("Programme exécuté en %ld us\n", us); printf("Programme exécuté en %ld us\n", us);
printf("GRAPH;62;%d;%ld\n", nb, us );
} }
return err; return err;
} }