How to evaluate the time to run iterations per UDF
Valérie Gelbgras
Member, Employee Posts: 157
✭✭✭✭
Answers
-
We can use the function defined in the librairy time.h. An example is given below. With the macro DEFINE_ADJUST, we evaluate the clock time before the iteration. With the macro DEFINE_EXECUTE_AT_END, we evaluate the clock time after the iteration. Finally, we write the the elapsed time in a text file.
#include "udf.h" #include <time.h> clock_t start_t, end_t; DEFINE_ADJUST(start_t_evaluation,domain) { start_t=clock(); } DEFINE_EXECUTE_AT_END(end_t_evaluation) { FILE *fp=fopen("time_monitor.txt","a"); end_t=clock(); fprintf(fp, "%d seconds for iteration # %d\n",(end_t-start_t)/ (CLOCKS_PER_SEC),N_ITER); fclose(fp); }
0