in Source/Tx.Windows/PerfCounters/PerfCounterFileReader.cs [32:72]
public void Read()
{
try
{
if (_firstMove)
{
// some counters need two samples to calculate their value
// so skip a sample to make sure there are no further complications
PdhNativeMethods.PdhCollectQueryData(_query);
_firstMove = false;
}
while (true)
{
long time;
PdhStatus status = PdhNativeMethods.PdhCollectQueryDataWithTime(_query, out time);
if (status == PdhStatus.PDH_NO_MORE_DATA)
break;
if (status == PdhStatus.PDH_NO_DATA)
if (_binaryLog)
continue;
else
break;
PdhUtils.CheckStatus(status, PdhStatus.PDH_CSTATUS_VALID_DATA);
DateTime timestamp = TimeUtil.FromFileTime(time);
foreach (PerfCounterInfo counterInfo in _counters)
{
ProduceCounterSamples(counterInfo, timestamp);
}
}
_observer.OnCompleted();
}
catch (Exception ex)
{
_observer.OnError(ex);
}
}