public static PdhStatus GetRawValue( this PdhCounter counter, out PDH_RAW_COUNTER value) => PdhExports.PdhGetRawCounterValue( counter, out _, out value);
public long SetCounterValue(PerformanceCounterSample sample, out bool bUnknownPath) { bUnknownPath = false; string key = sample.Path.ToLower(CultureInfo.InvariantCulture); if (!this.m_ReloggerPathToHandleAndInstanceMap.ContainsKey(key)) { bUnknownPath = true; return(0); } PDH_RAW_COUNTER pdh_raw_counter = new PDH_RAW_COUNTER { FirstValue = (long)sample.RawValue, SecondValue = (long)sample.SecondValue, MultiCount = sample.MultipleCount }; DateTime time2 = new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc); pdh_raw_counter.TimeStamp.dwHighDateTime = (int)(((ulong)(time2.ToFileTimeUtc() >> 0x20)) & 0xffffffffL); DateTime time4 = new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc); pdh_raw_counter.TimeStamp.dwLowDateTime = (int)(((ulong)time4.ToFileTimeUtc()) & 0xffffffffL); pdh_raw_counter.CStatus = sample.Status; return(PdhSetCounterValue(this.m_ReloggerPathToHandleAndInstanceMap[key].hCounter, ref pdh_raw_counter, this.m_ReloggerPathToHandleAndInstanceMap[key].InstanceName)); }
public static extern PdhStatus PdhCalculateCounterFromRawValue( PdhCounter hCounter, PdhFmt dwFormat, ref PDH_RAW_COUNTER rawValue1, ref PDH_RAW_COUNTER rawValue2, out PDH_FMT_COUNTERVALUE fmtValue);
public static extern PdhStatus PdhGetRawCounterValue(PdhCounter counter, out int lpdwType, out PDH_RAW_COUNTER pValue);
public long SetCounterValue(PerformanceCounterSample sample, out bool bUnknownPath) { bUnknownPath = false; string key = sample.Path.ToLower(CultureInfo.InvariantCulture); if (!this.m_ReloggerPathToHandleAndInstanceMap.ContainsKey(key)) { bUnknownPath = true; return 0; } PDH_RAW_COUNTER pdh_raw_counter = new PDH_RAW_COUNTER { FirstValue = (long) sample.RawValue, SecondValue = (long) sample.SecondValue, MultiCount = sample.MultipleCount }; DateTime time2 = new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc); pdh_raw_counter.TimeStamp.dwHighDateTime = (int) (((ulong) (time2.ToFileTimeUtc() >> 0x20)) & 0xffffffffL); DateTime time4 = new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc); pdh_raw_counter.TimeStamp.dwLowDateTime = (int) (((ulong) time4.ToFileTimeUtc()) & 0xffffffffL); pdh_raw_counter.CStatus = sample.Status; return PdhSetCounterValue(this.m_ReloggerPathToHandleAndInstanceMap[key].hCounter, ref pdh_raw_counter, this.m_ReloggerPathToHandleAndInstanceMap[key].InstanceName); }
private static extern long PdhSetCounterValue(IntPtr CounterHandle, ref PDH_RAW_COUNTER Value, string InstanceName);
private static extern long PdhGetRawCounterValue(IntPtr hCounter, out IntPtr lpdwType, out PDH_RAW_COUNTER pValue);
private static extern uint PdhSetCounterValue(IntPtr CounterHandle, ref PDH_RAW_COUNTER Value, /*PPDH_RAW_COUNTER */ string InstanceName );
public uint SetCounterValue(PerformanceCounterSample sample, out bool bUnknownPath) { Debug.Assert(_hOutputLog != null && !_hOutputLog.IsInvalid); bUnknownPath = false; string lcPath = sample.Path.ToLower(CultureInfo.InvariantCulture); if (!_reloggerPathToHandleAndInstanceMap.ContainsKey(lcPath)) { bUnknownPath = true; return 0; } PDH_RAW_COUNTER rawStruct = new PDH_RAW_COUNTER(); rawStruct.FirstValue = (long)sample.RawValue; rawStruct.SecondValue = (long)sample.SecondValue; rawStruct.MultiCount = sample.MultipleCount; rawStruct.TimeStamp.dwHighDateTime = (int)((new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc).ToFileTimeUtc() >> 32) & 0xFFFFFFFFL); rawStruct.TimeStamp.dwLowDateTime = (int)(new DateTime(sample.Timestamp.Ticks, DateTimeKind.Utc).ToFileTimeUtc() & 0xFFFFFFFFL); rawStruct.CStatus = sample.Status; return PdhSetCounterValue(_reloggerPathToHandleAndInstanceMap[lcPath].hCounter, ref rawStruct, /*PPDH_RAW_COUNTER */ _reloggerPathToHandleAndInstanceMap[lcPath].InstanceName); }