ivan@137: /************************************************************************** ivan@137: * ivan@137: * File name: ompprof.h ivan@137: * ivan@137: * Ron Rubinstein ivan@137: * Computer Science Department ivan@137: * Technion, Haifa 32000 Israel ivan@137: * ronrubin@cs ivan@137: * ivan@137: * Last Updated: 18.8.2009 ivan@137: * ivan@137: * Collection of definitions and functions for profiling the OMP method. ivan@137: * ivan@137: *************************************************************************/ ivan@137: ivan@137: ivan@137: #ifndef __OMP_PROF_H__ ivan@137: #define __OMP_PROF_H__ ivan@137: ivan@137: #include "mex.h" ivan@137: #include ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * ivan@137: * Constants and data types. ivan@137: * ivan@137: **************************************************************************/ ivan@137: ivan@137: ivan@137: /* constants denoting the various parts of the algorithm */ ivan@137: ivan@137: enum { DtX_TIME, XtX_TIME, DtR_TIME, MAXABS_TIME, DtD_TIME, LCHOL_TIME, COMPCOEF_TIME, ivan@137: UPDATE_DtR_TIME, UPDATE_RESNORM_TIME, COMPRES_TIME, INDEXSORT_TIME }; ivan@137: ivan@137: ivan@137: ivan@137: /* profiling data container with counters for each part of the algorithm */ ivan@137: ivan@137: typedef struct profdata ivan@137: { ivan@137: clock_t prevtime; /* the time when last initialization/call to addproftime() was performed */ ivan@137: ivan@137: clock_t DtX_time; ivan@137: clock_t XtX_time; ivan@137: clock_t DtR_time; ivan@137: clock_t maxabs_time; ivan@137: clock_t DtD_time; ivan@137: clock_t Lchol_time; ivan@137: clock_t compcoef_time; ivan@137: clock_t update_DtR_time; ivan@137: clock_t update_resnorm_time; ivan@137: clock_t compres_time; ivan@137: clock_t indexsort_time; ivan@137: ivan@137: /* flags indicating whether profiling data was gathered */ ivan@137: int DtX_time_counted; ivan@137: int XtX_time_counted; ivan@137: int DtR_time_counted; ivan@137: int DtD_time_counted; ivan@137: int update_DtR_time_counted; ivan@137: int resnorm_time_counted; ivan@137: int compres_time_counted; ivan@137: int indexsort_time_counted; ivan@137: ivan@137: } profdata; ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * ivan@137: * Initialize a profdata structure, zero all counters, and start its timer. ivan@137: * ivan@137: **************************************************************************/ ivan@137: void initprofdata(profdata *pd); ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * ivan@137: * Add elapsed time from last call to addproftime(), or from initialization ivan@137: * of profdata, to the counter specified by comptype. comptype must be one ivan@137: * of the constants in the enumeration above. ivan@137: * ivan@137: **************************************************************************/ ivan@137: void addproftime(profdata *pd, int comptype); ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * ivan@137: * Print the current contents of the counters in profdata. ivan@137: * ivan@137: * Parameters: ivan@137: * pd - the profdata to print ivan@137: * erroromp - indicates whether error-based (nonzero) or sparsity-based (zero) ivan@137: * omp was performed. ivan@137: * batchomp - indicates whether batch-omp (nonzero) or omp-cholesky (zero) ivan@137: * omp was performed. ivan@137: * signum - number of signals processed by omp ivan@137: * ivan@137: **************************************************************************/ ivan@137: void printprofinfo(profdata *pd, int erroromp, int batchomp, int signum); ivan@137: ivan@137: ivan@137: #endif ivan@137: