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() [1/2]

Timer ( )
inline

Definition at line 65 of file timer.h.

References Timer::Reset().

65 { Reset(); }
void Reset()
Definition: timer.h:71

◆ Timer() [2/2]

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

◆ Elapsed()

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(), NnetBatchComputer::Compute(), kaldi::CuRandGaussianMatrixBaseSpeedTest(), kaldi::CuRandGaussianMatrixSpeedTest(), kaldi::CuRandGaussianVectorSpeedTest(), kaldi::CuRandUniformMatrixBaseSpeedTest(), kaldi::CuRandUniformMatrixSpeedTest(), kaldi::CuRandUniformVectorSpeedTest(), OnlineFasterDecoder::Decode(), LatticeIncrementalDecoderTpl< FST, decoder::BackpointerToken >::Decode(), OnlineTimer::Elapsed(), Xent::Eval(), main(), OnlineTimer::OutputStats(), OnlinePaSource::Read(), CachingOptimizingCompiler::ReadCache(), NnetComputer::Run(), OnlineTimer::SleepUntil(), 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::TestCuSparseMatrixTraceMatSmat(), kaldi::TestCuVectorAddColSumMat(), kaldi::TestCuVectorAddDiagMat2(), kaldi::TestCuVectorAddDiagMat2OnVariousShapes(), kaldi::TestCuVectorAddDiagMatMat(), kaldi::TestCuVectorAddDiagMatMatShape(), kaldi::TestCuVectorAddRowSumMat(), kaldi::TestCuVectorApplyCeiling(), kaldi::TestCuVectorApplyCeilingNoCount(), kaldi::TestCuVectorApplyFloor(), kaldi::TestCuVectorApplyFloorNoCount(), 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(), kaldi::UnitTestSvdSpeed(), OnlineTimer::WaitUntil(), CachingOptimizingCompiler::WriteCache(), and NnetBatchDecoder::~NnetBatchDecoder().

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

◆ Reset()

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

◆ time_start_

struct timeval time_start_
private

Definition at line 87 of file timer.h.

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

◆ time_zone_

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: