Skip to content

Commit

Permalink
Add timers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Feb 29, 2024
1 parent c4e63cb commit 20f3e60
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/hex2tet.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <float.h>
#include <limits.h>

#include <time.h>

/**
* \param *prog pointer toward the program name.
*
Expand Down Expand Up @@ -290,6 +292,8 @@ int main(int argc,char *argv[]) {
MMG5_pSol mmgSol;
char chaine[128],*ptr;
int *hexa,nbhex,ier,fmtin;
clock_t t_start, t_end, t_cur ;
float tim;

fprintf(stdout,"\n -- H2T, Release %s (%s) \n",H2T_VER,H2T_REL);
fprintf(stdout," %s\n",H2T_CPY);
Expand All @@ -300,6 +304,8 @@ int main(int argc,char *argv[]) {
mmgSol = NULL;
hexa = NULL;

t_start = clock();

MMG3D_Init_mesh(MMG5_ARG_start,
MMG5_ARG_ppMesh,&mmgMesh,MMG5_ARG_ppMet,&mmgSol,
MMG5_ARG_end);
Expand Down Expand Up @@ -337,17 +343,43 @@ int main(int argc,char *argv[]) {
return H2T_STRONGFAILURE;
}

t_cur = clock();
tim = (float)(t_cur-t_start)/CLOCKS_PER_SEC;

if ( mmgMesh->info.imprim > 0 )
fprintf(stdout," -- INPUT DATA COMPLETED. %fs\n",tim);

/** call hex2tet library */
ier = H2T_libhex2tet(mmgMesh,&hexa,nbhex);

t_end = clock();
tim = (float)(t_end-t_cur)/CLOCKS_PER_SEC;

if ( mmgMesh->info.imprim >= 0 ) {
fprintf(stdout,"\n LIBHEX2TET: ELAPSED TIME %fs\n",tim);
}

t_cur = t_end;
MMG3D_saveMesh(mmgMesh,mmgMesh->nameout);

t_end = clock();
tim = (float)(t_end-t_cur)/CLOCKS_PER_SEC;

if ( mmgMesh->info.imprim > 0 )
fprintf(stdout," -- WRITING COMPLETED. %fs\n",tim);

/** free structures */
H2T_Free_all(MMG5_ARG_start,
MMG5_ARG_ppMesh,&mmgMesh,MMG5_ARG_ppMet,&mmgSol,
H2T_ARG_phexa,&hexa,
H2T_ARG_phexa,&hexa,
MMG5_ARG_end);

t_end = clock();
tim = (float)(t_end-t_start)/CLOCKS_PER_SEC;

if ( mmgMesh->info.imprim >= 0 ) {
fprintf(stdout, "\n END OF MODULE HEX2TET: TOTAL TIME %fs\n", tim);
}

return ier;
}

0 comments on commit 20f3e60

Please sign in to comment.