Commit 93fe2cee authored by Frank Bossen's avatar Frank Bossen

Add time reporting based on clock()

Use steady clock instead of high-precision one to guarantee monotonicity
parent fd79e91d
......@@ -147,9 +147,10 @@ int main(int argc, char* argv[])
#endif
// starting time
auto startTime = std::chrono::high_resolution_clock::now();
auto startTime = std::chrono::steady_clock::now();
std::time_t startTime2 = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
fprintf(stdout, " started @ %s", std::ctime(&startTime2) );
clock_t startClock = clock();
// call encoding function
#ifndef _DEBUG
......@@ -171,7 +172,8 @@ int main(int argc, char* argv[])
}
#endif
// ending time
auto endTime = std::chrono::high_resolution_clock::now();
clock_t endClock = clock();
auto endTime = std::chrono::steady_clock::now();
std::time_t endTime2 = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
auto encTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime- startTime ).count();
// destroy application encoder class
......@@ -181,7 +183,9 @@ int main(int argc, char* argv[])
printf( "\n finished @ %s", std::ctime(&endTime2) );
printf(" Total Time: %12.3f sec.\n", encTime / 1000.0 );
printf(" Total Time: %12.3f sec. [user] %12.3f sec. [elapsed]\n",
(endClock - startClock) * 1.0 / CLOCKS_PER_SEC,
encTime / 1000.0);
return 0;
}
......
......@@ -1535,7 +1535,7 @@ Void EncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, PicList& rcListPic,
}
//-- For time output for each slice
auto beforeTime = std::chrono::high_resolution_clock::now();
auto beforeTime = std::chrono::steady_clock::now();
#if !X0038_LAMBDA_FROM_QP_CAPABILITY
UInt uiColDir = calculateCollocatedFromL1Flag(m_pcCfg, iGOPid, m_iGopSize);
......@@ -2493,7 +2493,7 @@ Void EncGOP::compressGOP( Int iPOCLast, Int iNumPicRcvd, PicList& rcListPic,
cabac_zero_word_padding(pcSlice, pcPic, binCountsInNalUnits, numBytesInVclNalUnits, accessUnit.back()->m_nalUnitData, m_pcCfg->getCabacZeroWordPaddingEnabled());
//-- For time output for each slice
auto elapsed = std::chrono::high_resolution_clock::now() - beforeTime;
auto elapsed = std::chrono::steady_clock::now() - beforeTime;
auto encTime = std::chrono::duration_cast<std::chrono::seconds>( elapsed ).count();
std::string digestStr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment