1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0032000: Foundation Classes - collect OSD_Timer time in message report

Added Message_MetricType_WallClock metric type handled by Message_AttributeMeter.
Added public OSD_Timer::GetWallClockTime() method.
This commit is contained in:
nds
2020-12-16 12:29:06 +03:00
committed by bugmaster
parent 53f46612d9
commit 9283bba22f
5 changed files with 68 additions and 44 deletions

View File

@@ -25,9 +25,9 @@
namespace
{
static Standard_CString Message_Table_PrintMetricTypeEnum[10] =
static Standard_CString Message_Table_PrintMetricTypeEnum[11] =
{
"NONE", "UserTimeCPU", "SystemTimeInfo", "MemPrivate", "MemVirtual",
"NONE", "UserTimeCPU", "SystemTimeInfo", "WallClock", "MemPrivate", "MemVirtual",
"MemWorkingSet", "MemWorkingSetPeak", "MemSwapUsage", "MemSwapUsagePeak", "MemHeapUsage"
};
}

View File

@@ -17,6 +17,7 @@
#include <Message.hxx>
#include <Message_Report.hxx>
#include <OSD_Chronometer.hxx>
#include <OSD_Timer.hxx>
#include <Precision.hxx>
#include <Standard_Dump.hxx>
@@ -128,6 +129,16 @@ void Message_AttributeMeter::SetAlertMetrics (const Handle(Message_AlertExtended
const NCollection_IndexedMap<Message_MetricType>& anActiveMetrics = aReport->ActiveMetrics();
// time metrics
if (anActiveMetrics.Contains (Message_MetricType_WallClock))
{
OSD_Timer aTimer;
aTimer.Start();
Standard_Real aTime = OSD_Timer::GetWallClockTime();
if (theStartValue)
aMeterAttribute->SetStartValue (Message_MetricType_WallClock, aTime);
else
aMeterAttribute->SetStopValue (Message_MetricType_WallClock, aTime);
}
if (anActiveMetrics.Contains (Message_MetricType_ProcessCPUUserTime) ||
anActiveMetrics.Contains (Message_MetricType_ProcessCPUSystemTime) ||
anActiveMetrics.Contains (Message_MetricType_ThreadCPUUserTime) ||

View File

@@ -22,6 +22,7 @@ enum Message_MetricType
Message_MetricType_ThreadCPUSystemTime, //!< OSD_Chronometer::GetThreadCPU system time
Message_MetricType_ProcessCPUUserTime, //!< OSD_Chronometer::GetProcessCPU user time
Message_MetricType_ProcessCPUSystemTime, //!< OSD_Chronometer::GetProcessCPU system time
Message_MetricType_WallClock, //!< OSD_Timer elapsed time
Message_MetricType_MemPrivate, //!< OSD_MemInfo::MemPrivate
Message_MetricType_MemVirtual, //!< OSD_MemInfo::MemVirtual
Message_MetricType_MemWorkingSet, //!< OSD_MemInfo::MemWorkingSet