annotate util/ksvd utils/ompbox utils/ompprof.h @ 137:9207d56c5547 ivand_dev

New ompbox in utils for testing purposes
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Thu, 21 Jul 2011 14:07:41 +0100
parents
children
rev   line source
ivan@137 1 /**************************************************************************
ivan@137 2 *
ivan@137 3 * File name: ompprof.h
ivan@137 4 *
ivan@137 5 * Ron Rubinstein
ivan@137 6 * Computer Science Department
ivan@137 7 * Technion, Haifa 32000 Israel
ivan@137 8 * ronrubin@cs
ivan@137 9 *
ivan@137 10 * Last Updated: 18.8.2009
ivan@137 11 *
ivan@137 12 * Collection of definitions and functions for profiling the OMP method.
ivan@137 13 *
ivan@137 14 *************************************************************************/
ivan@137 15
ivan@137 16
ivan@137 17 #ifndef __OMP_PROF_H__
ivan@137 18 #define __OMP_PROF_H__
ivan@137 19
ivan@137 20 #include "mex.h"
ivan@137 21 #include <time.h>
ivan@137 22
ivan@137 23
ivan@137 24
ivan@137 25 /**************************************************************************
ivan@137 26 *
ivan@137 27 * Constants and data types.
ivan@137 28 *
ivan@137 29 **************************************************************************/
ivan@137 30
ivan@137 31
ivan@137 32 /* constants denoting the various parts of the algorithm */
ivan@137 33
ivan@137 34 enum { DtX_TIME, XtX_TIME, DtR_TIME, MAXABS_TIME, DtD_TIME, LCHOL_TIME, COMPCOEF_TIME,
ivan@137 35 UPDATE_DtR_TIME, UPDATE_RESNORM_TIME, COMPRES_TIME, INDEXSORT_TIME };
ivan@137 36
ivan@137 37
ivan@137 38
ivan@137 39 /* profiling data container with counters for each part of the algorithm */
ivan@137 40
ivan@137 41 typedef struct profdata
ivan@137 42 {
ivan@137 43 clock_t prevtime; /* the time when last initialization/call to addproftime() was performed */
ivan@137 44
ivan@137 45 clock_t DtX_time;
ivan@137 46 clock_t XtX_time;
ivan@137 47 clock_t DtR_time;
ivan@137 48 clock_t maxabs_time;
ivan@137 49 clock_t DtD_time;
ivan@137 50 clock_t Lchol_time;
ivan@137 51 clock_t compcoef_time;
ivan@137 52 clock_t update_DtR_time;
ivan@137 53 clock_t update_resnorm_time;
ivan@137 54 clock_t compres_time;
ivan@137 55 clock_t indexsort_time;
ivan@137 56
ivan@137 57 /* flags indicating whether profiling data was gathered */
ivan@137 58 int DtX_time_counted;
ivan@137 59 int XtX_time_counted;
ivan@137 60 int DtR_time_counted;
ivan@137 61 int DtD_time_counted;
ivan@137 62 int update_DtR_time_counted;
ivan@137 63 int resnorm_time_counted;
ivan@137 64 int compres_time_counted;
ivan@137 65 int indexsort_time_counted;
ivan@137 66
ivan@137 67 } profdata;
ivan@137 68
ivan@137 69
ivan@137 70
ivan@137 71 /**************************************************************************
ivan@137 72 *
ivan@137 73 * Initialize a profdata structure, zero all counters, and start its timer.
ivan@137 74 *
ivan@137 75 **************************************************************************/
ivan@137 76 void initprofdata(profdata *pd);
ivan@137 77
ivan@137 78
ivan@137 79 /**************************************************************************
ivan@137 80 *
ivan@137 81 * Add elapsed time from last call to addproftime(), or from initialization
ivan@137 82 * of profdata, to the counter specified by comptype. comptype must be one
ivan@137 83 * of the constants in the enumeration above.
ivan@137 84 *
ivan@137 85 **************************************************************************/
ivan@137 86 void addproftime(profdata *pd, int comptype);
ivan@137 87
ivan@137 88
ivan@137 89 /**************************************************************************
ivan@137 90 *
ivan@137 91 * Print the current contents of the counters in profdata.
ivan@137 92 *
ivan@137 93 * Parameters:
ivan@137 94 * pd - the profdata to print
ivan@137 95 * erroromp - indicates whether error-based (nonzero) or sparsity-based (zero)
ivan@137 96 * omp was performed.
ivan@137 97 * batchomp - indicates whether batch-omp (nonzero) or omp-cholesky (zero)
ivan@137 98 * omp was performed.
ivan@137 99 * signum - number of signals processed by omp
ivan@137 100 *
ivan@137 101 **************************************************************************/
ivan@137 102 void printprofinfo(profdata *pd, int erroromp, int batchomp, int signum);
ivan@137 103
ivan@137 104
ivan@137 105 #endif
ivan@137 106