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