annotate DL/RLS-DLA/private/ompprof.c @ 65:55faa9b5d1ac

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