greenplumn CAutoTimer 源码
greenplumn CAutoTimer 代码
文件路径:/src/backend/gporca/libgpos/src/common/CAutoTimer.cpp
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2008 - 2010 Greenplum, Inc.
//
// @filename:
// CAutoTimer.cpp
//
// @doc:
// Implementation of wrapper around wall clock timer
//---------------------------------------------------------------------------
#include "gpos/common/CAutoTimer.h"
#include "gpos/base.h"
#include "gpos/task/CAutoSuspendAbort.h"
using namespace gpos;
//---------------------------------------------------------------------------
// @function:
// CAutoTimer::CAutoTimer
//
// @doc:
// ctor
//
//---------------------------------------------------------------------------
CAutoTimer::CAutoTimer(const CHAR *sz, BOOL fPrint)
: m_timer_text_label(sz), m_print_text_label(fPrint)
{
GPOS_ASSERT(nullptr != sz);
}
//---------------------------------------------------------------------------
// @function:
// CAutoTimer::~CAutoTimer
//
// @doc:
// Destructor prints time difference and label
//
//---------------------------------------------------------------------------
CAutoTimer::~CAutoTimer() throw()
{
if (m_print_text_label)
{
// suspend cancellation - destructors should not throw
CAutoSuspendAbort asa;
ULONG ulElapsedTimeMS = m_clock.ElapsedMS();
GPOS_TRACE_FORMAT("timer:%s: %dms", m_timer_text_label,
ulElapsedTimeMS);
}
}
// EOF
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦