All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Timer Class Reference

#include <timer.h>

Collaboration diagram for Timer:

Public Member Functions

 Timer ()
 
 Timer (bool set_timer)
 
void Reset ()
 
double Elapsed () const
 Returns time in seconds. More...
 

Private Attributes

struct timeval time_start_
 
struct timezone time_zone_
 

Detailed Description

Definition at line 63 of file timer.h.

Constructor & Destructor Documentation

Timer ( )
inline

Definition at line 65 of file timer.h.

References Timer::Reset().

65 { Reset(); }
void Reset()
Definition: timer.h:71
Timer ( bool  set_timer)
inlineexplicit

Definition at line 69 of file timer.h.

References Timer::Reset().

69 { if (set_timer) Reset(); }
void Reset()
Definition: timer.h:71

Member Function Documentation

double Elapsed ( ) const
inline

Returns time in seconds.

Definition at line 74 of file timer.h.

References Timer::time_start_.

Referenced by CachingOptimizingCompiler::Compile(), kaldi::nnet3::CompileLooped(), CachingOptimizingCompiler::CompileNoShortcut(), CachingOptimizingCompiler::CompileViaShortcut(), kaldi::CuRandGaussianMatrixBaseSpeedTest(), kaldi::CuRandGaussianMatrixSpeedTest(), kaldi::CuRandGaussianVectorSpeedTest(), kaldi::CuRandUniformMatrixBaseSpeedTest(), kaldi::CuRandUniformMatrixSpeedTest(), kaldi::CuRandUniformVectorSpeedTest(), main(), CachingOptimizingCompiler::ReadCache(), NnetComputer::Run(), kaldi::TestCuFindRowMaxId(), kaldi::TestCuMatrixAddDiagVecMat(), kaldi::TestCuMatrixAddMat(), kaldi::TestCuMatrixAddMatBlocks(), kaldi::TestCuMatrixAddRowRanges(), kaldi::TestCuMatrixAddRows1(), kaldi::TestCuMatrixAddRows2(), kaldi::TestCuMatrixAddToRows(), kaldi::TestCuMatrixCholesky(), kaldi::TestCuMatrixCompObjfAndDeriv(), kaldi::TestCuMatrixCopyFromSp(), kaldi::TestCuMatrixCopyFromTp(), kaldi::TestCuMatrixCopyLowerToUpper(), kaldi::TestCuMatrixCopyRows1(), kaldi::TestCuMatrixCopyRows2(), kaldi::TestCuMatrixCopyToRows(), kaldi::TestCuMatrixCopyUpperToLower(), kaldi::TestCuMatrixDiffGroupPnorm(), kaldi::TestCuMatrixDiffLogSoftmax(), kaldi::TestCuMatrixDiffSoftmax(), kaldi::TestCuMatrixDivRowsVec(), kaldi::TestCuMatrixGroupMax(), kaldi::TestCuMatrixGroupMaxAllGroupSizes(), kaldi::TestCuMatrixGroupMaxDeriv(), kaldi::TestCuMatrixGroupPnorm(), kaldi::TestCuMatrixHeaviside(), kaldi::TestCuMatrixLogSoftmax(), kaldi::TestCuMatrixLookup(), kaldi::TestCuMatrixMatMat(), kaldi::TestCuMatrixMatMatBatched(), kaldi::TestCuMatrixMax(), kaldi::TestCuMatrixMin(), kaldi::TestCuMatrixMulRowsGroupMat(), kaldi::TestCuMatrixResize(), kaldi::TestCuMatrixSetZeroAboveDiag(), kaldi::TestCuMatrixSigmoid(), kaldi::TestCuMatrixSoftmax(), kaldi::TestCuMatrixSum(), kaldi::TestCuMatrixTraceMatMat(), kaldi::TestCuMatrixTransposeCross(), kaldi::TestCuMatrixTransposeNS(), kaldi::TestCuMatrixTransposeS(), kaldi::TestCuVectorAddColSumMat(), kaldi::TestCuVectorAddDiagMat2(), kaldi::TestCuVectorAddDiagMatMat(), kaldi::TestCuVectorAddRowSumMat(), kaldi::TestCuVectorCopyFromVec(), kaldi::TestCuVectorSoftmax(), kaldi::TestCuVectorSum(), kaldi::TestCuVectorVecVecOne(), kaldi::TestSymInvertPosDef(), kaldi::TimerTest(), kaldi::UnitTestAddColSumMatSpeed(), kaldi::UnitTestAddMatMatSpeed(), kaldi::UnitTestAddRowSumMatSpeed(), kaldi::UnitTestAddVecToColsSpeed(), kaldi::UnitTestAddVecToRowsSpeed(), kaldi::UnitTestBackpropLstmNonlinearity(), kaldi::UnitTestCuDiffNormalizePerRow(), kaldi::UnitTestCuMathComputeLstmNonlinearity(), kaldi::UnitTestCuMathNormalizePerRow(), kaldi::UnitTestCuSpMatrixCopyFromMat(), kaldi::UnitTestCuSpMatrixInvert(), kaldi::UnitTestExpSpeed(), kaldi::UnitTestLogSpeed(), kaldi::UnitTestPitchExtractionSpeed(), kaldi::UnitTestRealFftSpeed(), kaldi::UnitTestSplitRadixRealFftSpeed(), and kaldi::UnitTestSvdSpeed().

74  {
75  struct timeval time_end;
76  struct timezone time_zone;
77  gettimeofday(&time_end, &time_zone);
78  double t1, t2;
79  t1 = static_cast<double>(time_start_.tv_sec) +
80  static_cast<double>(time_start_.tv_usec)/(1000*1000);
81  t2 = static_cast<double>(time_end.tv_sec) +
82  static_cast<double>(time_end.tv_usec)/(1000*1000);
83  return t2-t1;
84  }
struct timeval time_start_
Definition: timer.h:87
void Reset ( )
inline

Definition at line 71 of file timer.h.

References Timer::time_start_, and Timer::time_zone_.

Referenced by main(), and Timer::Timer().

71 { gettimeofday(&this->time_start_, &time_zone_); }
struct timeval time_start_
Definition: timer.h:87
struct timezone time_zone_
Definition: timer.h:88

Member Data Documentation

struct timeval time_start_
private

Definition at line 87 of file timer.h.

Referenced by Timer::Elapsed(), and Timer::Reset().

struct timezone time_zone_
private

Definition at line 88 of file timer.h.

Referenced by Timer::Reset().


The documentation for this class was generated from the following file: