|
NCBI C++ ToolKit
|
Search Toolkit Book for CStopWatch
CStopWatch --. More...
#include <ncbitime.hpp>
Inheritance diagram for CStopWatch:Public Types | |
| enum | EStart { eStart, eStop } |
| Defines how to create new timer. More... | |
Public Member Functions | |
| CStopWatch (EStart state=eStop) | |
| Constructor. | |
| NCBI_DEPRECATED_CTOR (CStopWatch(bool start)) | |
| Constructor. | |
| void | Start (void) |
| Start the timer. | |
| double | Elapsed (void) const |
| Return time elapsed since first Start() or last Restart() call (in seconds). | |
| void | Stop (void) |
| Suspend the timer. | |
| double | Restart (void) |
| Return time elapsed since first Start() or last Restart() call (in seconds). | |
| void | Reset (void) |
| Stop (if running) and reset the timer. | |
| bool | IsRunning (void) |
| Check state of stopwatch. | |
| string | AsString (const CTimeFormat &format=kEmptyStr) const |
| Transform stopwatch time to string. | |
| operator string (void) const | |
| Return stopwatch time as string using the format returned by GetFormat(). | |
| string | AsSmartString (CTimeSpan::ESmartStringPrecision precision=CTimeSpan::eSSP_Nanosecond, ERound rounding=eTrunc, CTimeSpan::ESmartStringZeroMode zero_mode=CTimeSpan::eSSZ_Default) const |
| Transform elapsed time to "smart" string. | |
Static Public Member Functions | |
| static void | SetFormat (const CTimeFormat &format) |
| Set the current stopwatch time format. | |
| static CTimeFormat | GetFormat (void) |
| Get the current stopwatch time format. | |
Static Protected Member Functions | |
| static double | GetTimeMark () |
| Get current time mark. | |
Private Attributes | |
| double | m_Start |
| Start time value. | |
| double | m_Total |
| Accumulated elapsed time. | |
| EStart | m_State |
| Stopwatch state (started/stopped) | |
CStopWatch --.
Define a stop watch class to measure elasped time.
Definition at line 1672 of file ncbitime.hpp.
| enum CStopWatch::EStart |
Defines how to create new timer.
| eStart |
Start timer immediately after creating. |
| eStop |
Do not start timer, just create it. |
Definition at line 1676 of file ncbitime.hpp.
| CStopWatch::CStopWatch | ( | EStart | state = eStop | ) | [inline] |
Constructor.
NB. By default ctor doesn't start timer, it merely creates it.
Definition at line 2467 of file ncbitime.hpp.
| string CStopWatch::AsSmartString | ( | CTimeSpan::ESmartStringPrecision | precision = CTimeSpan::eSSP_Nanosecond, |
| ERound | rounding = eTrunc, |
||
| CTimeSpan::ESmartStringZeroMode | zero_mode = CTimeSpan::eSSZ_Default |
||
| ) | const [inline] |
Transform elapsed time to "smart" string.
For more details see CTimeSpan::AsSmartString().
| precision | Enum value describing how many parts of time span should be returned. |
| rounding | Rounding mode. |
| zero_mode | Mode to print or skip zero parts of time span. |
Definition at line 2560 of file ncbitime.hpp.
References CTimeSpan::AsSmartString().
Referenced by CBlastDbBioseqSource::CBlastDbBioseqSource(), BlastdbCopyApplication::Run(), and COpenViewlDlgTask::x_Run().
| string CStopWatch::AsString | ( | const CTimeFormat & | format = kEmptyStr | ) | const |
Transform stopwatch time to string.
According to used OS, the double representation can provide much finer grained time control. The string representation is limited by nanoseconds.
| format | If "format" is not defined, then GetFormat() will be used. Format specifier used to convert value returned by Elapsed() to string. |
Definition at line 3072 of file ncbitime.cpp.
References CTimeSpan::AsString(), Elapsed(), GetFormat(), and CTimeFormat::IsEmpty().
Referenced by CDiagContext::GetProperty(), operator<<(), CSequenceInputStats::PrintReport(), and CDiagContext::x_PrintMessage().
| double CStopWatch::Elapsed | ( | void | ) | const [inline] |
Return time elapsed since first Start() or last Restart() call (in seconds).
Result is 0.0 if Start() or Restart() wasn't previously called.
Definition at line 2486 of file ncbitime.hpp.
References GetTimeMark().
Referenced by CBuildDatabase::AddSequences(), CThreadPool_Impl::AddTask(), CNcbiTestApplication::AdjustTestTimeout(), AsString(), CBuildDatabase::Build(), ConvertToPairwise(), CBDB_Cache::EvaluateTimeLine(), CExecute::Exec(), CSeqEntryPresenter::Finalize(), GetBlobReader(), CProcess::Kill(), CBDB_SplitTest::LoadSplitStore(), CBDB_SplitTest::LoadTestSet(), CReadDispatcher::LogStat(), CProjectTreePanel::OnDragOver(), CThreadPool_Controller_PID::OnEvent(), CGenBankUIDataSource::Open(), CSQLITE3_Cache::Open(), CNetBLASTUIDataSource::Open(), CQueryExecEvalFunc::operator()(), CPerfLogger::Post(), CFileHandleDiagHandler::Post(), CFileDiagHandler::Post(), CSeqEntryPresenter::Process(), CTruncateRequest::Process(), CGlCgiImageApplication::ProcessRequest(), CAsnvalApp::ReadClassMember(), CFileHandleDiagHandler::Reopen(), CFileDiagHandler::Reopen(), CSubImageApp::Run(), CConvImageApp::Run(), CSampleNetScheduleClient::Run(), CObjConvProfile::Run(), CMytestApplication::Run(), CProjBulderApp::Run(), CAnnotMetaDataJob::Run(), CDbapiTestSpeedApp::RunSample(), CPhyloTreePS::Update(), CLDS_Object::UpdateBinaryASNObject(), CBuildDatabase::x_AddRemoteSequences(), CRequestRateControl::x_Approve(), CForceJob::x_Calculate(), CAlnMultiDSBuilder::x_CreateSparseDataSource(), CComponentSearchJob::x_DoSearch(), CBuildDatabase::x_DupLocal(), CNetBLASTUIDataSource::x_GetDBTree(), CWorkerNodeIdleThread::x_GetInterval(), CRemoteBlast::x_GetRequestInfoFromRID(), CRemoteBlast::x_GetSubjects(), CWorkerNodeIdleThread::x_IsAutoShutdownTime(), CSyncQueue< Type, Container >::x_LockAndWait(), CNetScheduleHandler::x_ProcessMsgBatchSubmit(), CId2FetchApp::x_ProcessRequest(), IPhyloTreeRenderer::x_RenderNode(), CRemoteBlast::x_SendRequest(), CThreadPool_Impl::x_WaitForPredicate(), CTimedReporter::~CTimedReporter(), and SW::~SW().
| CTimeFormat CStopWatch::GetFormat | ( | void | ) | [static] |
Get the current stopwatch time format.
The default format is: "-S.n".
Definition at line 3059 of file ncbitime.cpp.
References format, CStaticTls< TValue >::GetValue(), kDefaultFormatStopWatch, and CTimeFormat::SetFormat().
Referenced by AsString().
| double CStopWatch::GetTimeMark | ( | ) | [static, protected] |
Get current time mark.
Definition at line 3017 of file ncbitime.cpp.
| bool CStopWatch::IsRunning | ( | void | ) | [inline] |
Check state of stopwatch.
Definition at line 2546 of file ncbitime.hpp.
Referenced by CFileHandleDiagHandler::Post(), CFileDiagHandler::Post(), CSeqEntryPresenter::Process(), CFileHandleDiagHandler::Reopen(), and CFileDiagHandler::Reopen().
| CStopWatch::NCBI_DEPRECATED_CTOR | ( | CStopWatch(bool start) | ) |
Constructor.
Start timer if argument is true.
| CStopWatch::operator string | ( | void | ) | const [inline] |
Return stopwatch time as string using the format returned by GetFormat().
Definition at line 2553 of file ncbitime.hpp.
| void CStopWatch::Reset | ( | void | ) | [inline] |
Stop (if running) and reset the timer.
Definition at line 2518 of file ncbitime.hpp.
Referenced by CRequestContext::Reset().
| double CStopWatch::Restart | ( | void | ) | [inline] |
Return time elapsed since first Start() or last Restart() call (in seconds).
Start new timer after that. Result is 0.0 if Start() or Restart() wasn't previously called.
Definition at line 2527 of file ncbitime.hpp.
References GetTimeMark().
Referenced by CDataTool::GenerateCode(), CSeqEntryPresenter::Initialize(), CProjectTreePanel::OnDragOver(), CSeqEntryPresenter::Process(), CFileHandleDiagHandler::Reopen(), CFileDiagHandler::Reopen(), CRequestRateControl::Reset(), CWorkerNodeIdleThread::Schedule(), CFileDiagHandler::SetLogFile(), CAlignSort::SortAlignments(), CRequestContext::StartRequest(), CWorkerNodeIdleThread::Suspend(), CPhyloTreePS::Update(), CRemoteBlast::x_GetSearchResultsHTTP(), and CNetScheduleHandler::x_ProcessBatchStart().
| void CStopWatch::SetFormat | ( | const CTimeFormat & | format | ) | [static] |
Set the current stopwatch time format.
The default format is: "-S.n".
| format | Format specifier used to convert time span to string. If "format" is not defined, then GetFormat() will be used. Uses the same time format as CTimeSpan class. |
Definition at line 3050 of file ncbitime.cpp.
References s_TlsFormatCleanup(), and CStaticTls< TValue >::SetValue().
| void CStopWatch::Start | ( | void | ) | [inline] |
Start the timer.
Definition at line 2478 of file ncbitime.hpp.
References GetTimeMark().
Referenced by CHitClustering::Build(), CScoringJob::Calculate(), CBDB_SplitCursor< BDB_SplitStore, BDB_Vol >::CBDB_SplitCursor(), CBlastDbBioseqSource::CBlastDbBioseqSource(), ConvertToPairwise(), CTimedReporter::CTimedReporter(), CWorkspaceConstPrx::CWorkspaceConstPrx(), CExecute::Exec(), GetBlobReader(), CProcess::Kill(), CProcess::KillGroup(), CBamUIDataSource::Open(), CGenBankUIDataSource::Open(), CSQLITE3_Cache::Open(), CNetBLASTUIDataSource::Open(), IPhyloTreeRenderer::PointToNode(), CGlCgiImageApplication::ProcessRequest(), CSubImageApp::Run(), BlastdbCopyApplication::Run(), CConvImageApp::Run(), CBlastInputDemoApplication::Run(), CObjConvProfile::Run(), CMytestApplication::Run(), CProjBulderApp::Run(), CAnnotMetaDataJob::Run(), CDbapiTestSpeedApp::RunSample(), CPerfLogger::Start(), SW::SW(), CPhyloTreePS::Update(), CNetBLASTUIDataSource::x_AddCategorizedDBs(), CForceJob::x_Calculate(), CAlnMultiDSBuilder::x_CreateSparseDataSource(), CComponentSearchJob::x_DoSearch(), CCrossPanelIR::x_DrawCrossAlignment(), CNetBLASTUIDataSource::x_GetDBTree(), CRemoteBlast::x_GetSearchResultsHTTP(), and CPhyloTreePane::x_RenderContent().
| void CStopWatch::Stop | ( | void | ) | [inline] |
Suspend the timer.
Next Start() call continue to count time accured before.
Definition at line 2503 of file ncbitime.hpp.
References GetTimeMark().
Referenced by CBlastDbBioseqSource::CBlastDbBioseqSource(), CSeqEntryPresenter::Finalize(), CNcbiTestApplication::InitTestFramework(), CProjectTreePanel::OnBeginDrag(), CProjectTreePanel::OnDragOver(), CSeqEntryPresenter::Process(), BlastdbCopyApplication::Run(), CBlastInputDemoApplication::Run(), CPerfLogger::Suspend(), CWorkerNodeIdleThread::Suspend(), CPhyloTreePS::Update(), CRemoteBlast::x_GetSearchResultsHTTP(), COpenViewlDlgTask::x_Run(), and CWorkspaceConstPrx::~CWorkspaceConstPrx().
double CStopWatch::m_Start [private] |
Start time value.
Definition at line 1780 of file ncbitime.hpp.
EStart CStopWatch::m_State [private] |
Stopwatch state (started/stopped)
Definition at line 1782 of file ncbitime.hpp.
double CStopWatch::m_Total [private] |
Accumulated elapsed time.
Definition at line 1781 of file ncbitime.hpp.
1.7.5.1
Modified on Wed Feb 08 09:07:58 2012 by modify_doxy.py rev. 337098