From 89c593ad38619b6ebd27df2684e5e53bb5e76dd4 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 20 Oct 2023 14:43:14 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20Outil=20de=20mesure=20du=20temps=20CPU?= =?UTF-8?q?=20pour=20des=20nombres=20de=20vertex=20croissants;=20'd=C3=A9c?= =?UTF-8?q?rochage'=20exp=20vers=2010=E2=81=B6=20vertex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/graphics.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 1b7b9fd..6a37b0e 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -30,6 +30,7 @@ #include "../../include/graphics.h" #include "../../include/arrows.h" #include "../../include/grid.h" +// #include TODO #define VERTEX_SHADER_FILE "src/shaders/shader.vert" #define FRAG_SHADER_FILE "src/shaders/shader.frag" @@ -676,7 +677,7 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int rand(void); void srand(unsigned int seed); // printf ("Valeur max : %d\n", RAND_MAX); min + rand() % (max+1 - min); - int arbitrary = 200; + int arbitrary = 0; int space_X = 1 + rand() % arbitrary, space_Y = 1 + rand() % arbitrary, space_Z = 1 + rand() % arbitrary; @@ -689,14 +690,35 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int specif_arrows_nb = rand() % density_max / 3; int arrows_nb = 0; - while (arrows_nb < specif_arrows_nb){ + /* while (arrows_nb < specif_arrows_nb){ */ + /* arrows_nb = set_arrow (arrows, arrows_nb, */ + /* rand() % arbitrary + 1, // load / weight */ + /* rand() % 6, // site, */ + /* rand() % space_X, // x */ + /* rand() % space_Y, // y */ + /* rand() % space_Z); // z */ + /* } */ + + // clock_t start, end; + + /* Recording the starting clock tick.*/ + // start = clock(); + + arbitrary = 24; + space_X = arbitrary; space_Y = arbitrary; space_Z = arbitrary; + density_max = space_X * space_Y * space_Z; + for (int i =0; i < space_X; i++) + for (int j =0; j < space_Y; j++) + for (int k =0; k < space_Z; k++) + for (int u =0; u < 6; u++) arrows_nb = set_arrow (arrows, arrows_nb, - rand() % arbitrary, // load / weight - rand() % 6, // site, - rand() % space_X, // x - rand() % space_Y, // y - rand() % space_Z); // z - } + 1, // load / weight + u,//i % 6, // site, + i,//i % space_X, // x + j,//i % space_Y, // y + k//i % space_Z); + ); + // end = clock(); printf("Elapsed time %ld\n", end - start); print_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, print_arrows_data, show_space_design);