IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
KNTimeMeasurement.cpp
Go to the documentation of this file.
1 
7 #include "KNTimeMeasurement.h"
8 #include <time.h>
9 
14 
15 
17 {
18 }
19 
21 {
22 }
23 
25 {
26  int i;
27 
28  for( i = 0; i < MEASUREMENT_COUNT ; i ++ )
29  {
30  m_fStartTime[i] = 0.;
31  m_fTakeTime[i] = 0.;
32  }
33 }
34 
36 {
37 #ifdef DOING_MEASUREMENT
38 #ifdef DISABLE_MPI_ROUTINE
39  m_fTotalTimeStart = clock() / CLOCKS_PER_SEC;;
40 #else //DISABLE_MPI_ROUTINE
41  m_fTotalTimeStart = MPI_Wtime();
42 #endif //DISABLE_MPI_ROUTINE
43 #endif
44 }
45 
47 {
48 #ifdef DOING_MEASUREMENT
49 #ifdef DISABLE_MPI_ROUTINE
50  m_fTotalTimeEnd = clock() / CLOCKS_PER_SEC;;
51 #else //DISABLE_MPI_ROUTINE
52  m_fTotalTimeEnd = MPI_Wtime();
53 #endif //DISABLE_MPI_ROUTINE
54 #endif
55 }
56 
62 {
63 #ifdef DOING_MEASUREMENT
64  return m_fTakeTime[index];
65 #else //DOING_MEASUREMENT
66  return 0;
67 #endif
68 }
69 
74 {
75 #ifdef DOING_MEASUREMENT
76 #ifdef DISABLE_MPI_ROUTINE
77  m_fStartTime[index] = clock();
78 #else //DISABLE_MPI_ROUTINE
79  m_fStartTime[index] = MPI_Wtime();
80 #endif //DISABLE_MPI_ROUTINE
81 #endif
82 }
83 
88 {
89 #ifdef DOING_MEASUREMENT
90 #ifdef DISABLE_MPI_ROUTINE
91  m_fTakeTime[index] += (clock() - m_fStartTime[index])/CLOCKS_PER_SEC;;
92 #else //DISABLE_MPI_ROUTINE
93  m_fTakeTime[index] += (MPI_Wtime() - m_fStartTime[index]);
94 #endif //DISABLE_MPI_ROUTINE
95 #endif
96 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static double GetTakeTime(MEASUREMENT_INDEX index)
Get taken time for part.
static double m_fTotalTimeStart
Get total taken time.
Time measurement class.
static double m_fTotalTimeEnd
End time for total.
static double m_fTakeTime[MEASUREMENT_COUNT]
End time for part.
static double m_fStartTime[MEASUREMENT_COUNT]
Start time for part.
static void TotalMeasurementEnd()
Measurement end for total taken time.
static void TotalMeasurementStart()
Measurement start for total taken time.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
static void InitTimer()
Init time related variable.
#define MEASUREMENT_COUNT
Part numbers.