本文整理汇总了C++中scxcorelib::SCXHandle::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ SCXHandle::Reset方法的具体用法?C++ SCXHandle::Reset怎么用?C++ SCXHandle::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scxcorelib::SCXHandle
的用法示例。
在下文中一共展示了SCXHandle::Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateInstances
/**
Update all instances.
*/
void StatisticalLogicalDiskEnumeration::UpdateInstances()
{
scxulong total_reads = 0;
scxulong total_writes = 0;
#if defined(hpux)
scxulong total_tTime = 0;
#endif
scxulong total_rTime = 0;
scxulong total_wTime = 0;
scxulong total_transfers = 0;
scxulong total_rPercent = 0;
scxulong total_wPercent = 0;
scxulong total_tPercent = 0;
SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> total = GetTotalInstance();
if (0 != total)
{
total->Reset();
total->m_online = true;
}
for (EntityIterator iter = Begin(); iter != End(); iter++)
{
SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> disk = *iter;
disk->Update();
if (0 != total)
{
total->m_readsPerSec += disk->m_readsPerSec;
total->m_writesPerSec += disk->m_writesPerSec;
total->m_transfersPerSec += disk->m_transfersPerSec;
total->m_rBytesPerSec += disk->m_rBytesPerSec;
total->m_wBytesPerSec += disk->m_wBytesPerSec;
total->m_tBytesPerSec += disk->m_tBytesPerSec;
total->m_rTime += disk->m_rTime;
total->m_wTime += disk->m_wTime;
total->m_tTime += disk->m_tTime;
total->m_runTime += disk->m_runTime;
total->m_waitTime += disk->m_waitTime;
total->m_mbUsed += disk->m_mbUsed;
total->m_mbFree += disk->m_mbFree;
total_reads += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_writes += disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#if defined (hpux)
total_transfers += disk->m_transfers.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_tTime += disk->m_tTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#elif defined (linux)
total_transfers += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES) + disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_rTime += disk->m_rTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_wTime += disk->m_wTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#elif defined (sun)
total_transfers += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES) + disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_rTime += disk->m_runTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_wTime += disk->m_waitTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#endif
total_rPercent += disk->m_rPercentage;
total_wPercent += disk->m_wPercentage;
total_tPercent += disk->m_tPercentage;
}
}
if (0 != total)
{
if (Size() > 0)
{
total->m_rPercentage = total_rPercent/Size();
total->m_wPercentage = total_wPercent/Size();
total->m_tPercentage = total_tPercent/Size();
}
if (total_reads != 0)
{
total->m_secPerRead = static_cast<double>(total_rTime) / static_cast<double>(total_reads) / 1000.0;
}
if (total_writes != 0)
{
total->m_secPerWrite = static_cast<double>(total_wTime) / static_cast<double>(total_writes) / 1000.0;
}
if (total_transfers != 0)
{
#if defined(hpux)
total->m_secPerTransfer = static_cast<double>(total_tTime) / static_cast<double>(total_transfers) / 1000.0;
#elif defined(linux) || defined(sun)
total->m_secPerTransfer = static_cast<double>(total_rTime+total_wTime) / static_cast<double>(total_transfers) / 1000.0;
#endif
}
}
}
示例2: UpdateInstances
/**
Update all instances.
*/
void StatisticalLogicalDiskEnumeration::UpdateInstances()
{
scxulong total_reads = 0;
scxulong total_writes = 0;
#if defined(hpux)
scxulong total_tTime = 0;
#endif
scxulong total_rTime = 0;
scxulong total_wTime = 0;
scxulong total_transfers = 0;
scxulong total_rPercent = 0;
scxulong total_wPercent = 0;
scxulong total_tPercent = 0;
set<wstring> diskSet;
pair<set<wstring>::iterator,bool> Pair;
SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> total = GetTotalInstance();
if (0 != total)
{
total->Reset();
SCX_LOGTRACE(m_log, L"Device being set to ONLINE for TOTAL instance");
total->m_online = true;
}
for (EntityIterator iter = Begin(); iter != End(); ++iter)
{
SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> disk = *iter;
disk->Update();
Pair = diskSet.insert(disk->m_device);
if(Pair.second == false)
continue;
if (0 != total)
{
total->m_readsPerSec += disk->m_readsPerSec;
total->m_writesPerSec += disk->m_writesPerSec;
total->m_transfersPerSec += disk->m_transfersPerSec;
total->m_rBytesPerSec += disk->m_rBytesPerSec;
total->m_wBytesPerSec += disk->m_wBytesPerSec;
total->m_tBytesPerSec += disk->m_tBytesPerSec;
total->m_rTime += disk->m_rTime;
total->m_wTime += disk->m_wTime;
total->m_tTime += disk->m_tTime;
total->m_runTime += disk->m_runTime;
total->m_waitTime += disk->m_waitTime;
total->m_mbUsed += disk->m_mbUsed;
total->m_mbFree += disk->m_mbFree;
total_reads += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_writes += disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#if defined (hpux)
total_transfers += disk->m_transfers.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_tTime += disk->m_tTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#elif defined (linux)
total_transfers += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES) + disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_rTime += disk->m_rTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_wTime += disk->m_wTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#elif defined (sun)
total_transfers += disk->m_reads.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES) + disk->m_writes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_rTime += disk->m_runTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
total_wTime += disk->m_waitTimes.GetDelta(MAX_DISKINSTANCE_DATASAMPER_SAMPLES);
#endif
total_rPercent += disk->m_rPercentage;
total_wPercent += disk->m_wPercentage;
total_tPercent += disk->m_tPercentage;
}
}
if (0 != total)
{
if (Size() > 0)
{
total->m_rPercentage = total_rPercent/Size();
total->m_wPercentage = total_wPercent/Size();
total->m_tPercentage = total_tPercent/Size();
}
if (total_reads != 0)
{
total->m_secPerRead = static_cast<double>(total_rTime) / static_cast<double>(total_reads) / 1000.0;
}
if (total_writes != 0)
{
total->m_secPerWrite = static_cast<double>(total_wTime) / static_cast<double>(total_writes) / 1000.0;
}
if (total_transfers != 0)
{
#if defined(hpux)
total->m_secPerTransfer = static_cast<double>(total_tTime) / static_cast<double>(total_transfers) / 1000.0;
#elif defined(linux) || defined(sun)
total->m_secPerTransfer = static_cast<double>(total_rTime+total_wTime) / static_cast<double>(total_transfers) / 1000.0;
#endif
}
}
}