Mercurial > hg > smallbox
comparison DL/RLS-DLA/private/ompprof.c @ 60:ad36f80e2ccf
(none)
author | idamnjanovic |
---|---|
date | Tue, 15 Mar 2011 12:20:59 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
59:23f9dd7b9d78 | 60:ad36f80e2ccf |
---|---|
1 /************************************************************************** | |
2 * | |
3 * File name: ompprof.c | |
4 * | |
5 * Ron Rubinstein | |
6 * Computer Science Department | |
7 * Technion, Haifa 32000 Israel | |
8 * ronrubin@cs | |
9 * | |
10 * Last Updated: 11.4.2009 | |
11 * | |
12 *************************************************************************/ | |
13 | |
14 | |
15 #include "ompprof.h" | |
16 | |
17 | |
18 /* initialize profiling information */ | |
19 | |
20 void initprofdata(profdata *pd) | |
21 { | |
22 pd->DtX_time = 0; | |
23 pd->XtX_time = 0; | |
24 pd->DtR_time = 0; | |
25 pd->maxabs_time = 0; | |
26 pd->DtD_time = 0; | |
27 pd->Lchol_time = 0; | |
28 pd->compcoef_time = 0; | |
29 pd->update_DtR_time = 0; | |
30 pd->update_resnorm_time = 0; | |
31 pd->compres_time = 0; | |
32 pd->indexsort_time = 0; | |
33 | |
34 pd->DtX_time_counted = 0; | |
35 pd->XtX_time_counted = 0; | |
36 pd->DtR_time_counted = 0; | |
37 pd->DtD_time_counted = 0; | |
38 pd->update_DtR_time_counted = 0; | |
39 pd->resnorm_time_counted = 0; | |
40 pd->compres_time_counted = 0; | |
41 pd->indexsort_time_counted = 0; | |
42 | |
43 pd->prevtime = clock(); | |
44 } | |
45 | |
46 | |
47 /* add elapsed time to profiling data according to specified computation */ | |
48 | |
49 void addproftime(profdata *pd, int comptype) | |
50 { | |
51 switch(comptype) { | |
52 case DtX_TIME: pd->DtX_time += clock()-pd->prevtime; pd->DtX_time_counted = 1; break; | |
53 case XtX_TIME: pd->XtX_time += clock()-pd->prevtime; pd->XtX_time_counted = 1; break; | |
54 case DtR_TIME: pd->DtR_time += clock()-pd->prevtime; pd->DtR_time_counted = 1; break; | |
55 case DtD_TIME: pd->DtD_time += clock()-pd->prevtime; pd->DtD_time_counted = 1; break; | |
56 case COMPRES_TIME: pd->compres_time += clock()-pd->prevtime; pd->compres_time_counted = 1; break; | |
57 case UPDATE_DtR_TIME: pd->update_DtR_time += clock()-pd->prevtime; pd->update_DtR_time_counted = 1; break; | |
58 case UPDATE_RESNORM_TIME: pd->update_resnorm_time += clock()-pd->prevtime; pd->resnorm_time_counted = 1; break; | |
59 case INDEXSORT_TIME: pd->indexsort_time += clock()-pd->prevtime; pd->indexsort_time_counted = 1; break; | |
60 case MAXABS_TIME: pd->maxabs_time += clock()-pd->prevtime; break; | |
61 case LCHOL_TIME: pd->Lchol_time += clock()-pd->prevtime; break; | |
62 case COMPCOEF_TIME: pd->compcoef_time += clock()-pd->prevtime; break; | |
63 } | |
64 pd->prevtime = clock(); | |
65 } | |
66 | |
67 | |
68 /* print profiling info */ | |
69 | |
70 void printprofinfo(profdata *pd, int erroromp, int batchomp, int signum) | |
71 { | |
72 clock_t tottime; | |
73 | |
74 tottime = pd->DtX_time + pd->XtX_time + pd->DtR_time + pd->DtD_time + pd->compres_time + pd->maxabs_time + | |
75 pd->Lchol_time + pd->compcoef_time + pd->update_DtR_time + pd->update_resnorm_time + pd->indexsort_time; | |
76 | |
77 mexPrintf("\n\n***** Profiling information for %s *****\n\n", erroromp? "OMP2" : "OMP"); | |
78 | |
79 mexPrintf("OMP mode: %s\n\n", batchomp? "Batch-OMP" : "OMP-Cholesky"); | |
80 | |
81 mexPrintf("Total signals processed: %d\n\n", signum); | |
82 | |
83 if (pd->DtX_time_counted) { | |
84 mexPrintf("Compute DtX time: %7.3lf seconds\n", pd->DtX_time/(double)CLOCKS_PER_SEC); | |
85 } | |
86 if (pd->XtX_time_counted) { | |
87 mexPrintf("Compute XtX time: %7.3lf seconds\n", pd->XtX_time/(double)CLOCKS_PER_SEC); | |
88 } | |
89 mexPrintf("Max abs time: %7.3lf seconds\n", pd->maxabs_time/(double)CLOCKS_PER_SEC); | |
90 if (pd->DtD_time_counted) { | |
91 mexPrintf("Compute DtD time: %7.3lf seconds\n", pd->DtD_time/(double)CLOCKS_PER_SEC); | |
92 } | |
93 mexPrintf("Lchol update time: %7.3lf seconds\n", pd->Lchol_time/(double)CLOCKS_PER_SEC); | |
94 mexPrintf("Compute coef time: %7.3lf seconds\n", pd->compcoef_time/(double)CLOCKS_PER_SEC); | |
95 if (pd->compres_time_counted) { | |
96 mexPrintf("Compute R time: %7.3lf seconds\n", pd->compres_time/(double)CLOCKS_PER_SEC); | |
97 } | |
98 if (pd->DtR_time_counted) { | |
99 mexPrintf("Compute DtR time: %7.3lf seconds\n", pd->DtR_time/(double)CLOCKS_PER_SEC); | |
100 } | |
101 if (pd->update_DtR_time_counted) { | |
102 mexPrintf("Update DtR time: %7.3lf seconds\n", pd->update_DtR_time/(double)CLOCKS_PER_SEC); | |
103 } | |
104 if (pd->resnorm_time_counted) { | |
105 mexPrintf("Update resnorm time: %7.3lf seconds\n", pd->update_resnorm_time/(double)CLOCKS_PER_SEC); | |
106 } | |
107 if (pd->indexsort_time_counted) { | |
108 mexPrintf("Index sort time: %7.3lf seconds\n", pd->indexsort_time/(double)CLOCKS_PER_SEC); | |
109 } | |
110 mexPrintf("---------------------------------------\n"); | |
111 mexPrintf("Total time: %7.3lf seconds\n\n", tottime/(double)CLOCKS_PER_SEC); | |
112 } | |
113 |