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