public static PdhStatus GetRawValue(
     this PdhCounter counter,
     out PDH_RAW_COUNTER value)
 => PdhExports.PdhGetRawCounterValue(
     counter,
     out _,
     out value);
 public static PdhStatus GetFormattedValue(
     this PdhCounter counter,
     out PDH_FMT_COUNTERVALUE value)
 => PdhExports.PdhGetFormattedCounterValue(
     counter,
     DefaultFmt,
     out _,
     out value);
Esempio n. 3
0
        public static unsafe int EstimateFormattedCounterArraySize(this PdhCounter counter)
        {
            var size   = 0;
            var status = Pdh.PdhGetFormattedCounterArray(counter, DefaultFmt, ref size, out _, null);

            if (status != PdhStatus.PDH_CSTATUS_VALID_DATA && status != PdhStatus.PDH_MORE_DATA)
            {
                FailWithError(PdhStatus.PDH_MORE_DATA, nameof(Pdh.PdhGetFormattedCounterArray));
            }
            return(size);
        }
        public static unsafe int EstimateRawCounterArraySize(this PdhCounter counter)
        {
            var size = 0;

            PdhExports
            .PdhGetRawCounterArray(counter, ref size, out _, null)
            .EnsureStatus(
                PdhStatus.PDH_MORE_DATA,
                nameof(PdhExports.PdhGetRawCounterArray));

            return(size);
        }
        public static unsafe int EstimateFormattedCounterArraySize(this PdhCounter counter)
        {
            var size = 0;

            PdhExports
            .PdhGetFormattedCounterArray(counter, DefaultFmt, ref size, out _, null)
            .EnsureStatus(
                PdhStatus.PDH_CSTATUS_VALID_DATA,
                PdhStatus.PDH_MORE_DATA,
                nameof(PdhExports.PdhGetRawCounterArray));

            return(size);
        }
Esempio n. 6
0
 public static extern PdhStatus PdhCalculateCounterFromRawValue(
     PdhCounter hCounter, PdhFmt dwFormat,
     ref PDH_RAW_COUNTER rawValue1,
     ref PDH_RAW_COUNTER rawValue2,
     out PDH_FMT_COUNTERVALUE fmtValue);
Esempio n. 7
0
 public static extern PdhStatus PdhGetRawCounterValue(PdhCounter counter, out int lpdwType,
                                                      out PDH_RAW_COUNTER pValue);
Esempio n. 8
0
 public static extern unsafe PdhStatus PdhGetFormattedCounterArray(
     PdhCounter counter,
     PdhFmt dwFormat,
     ref int bufferSize,
     out int itemCount, PDH_FMT_COUNTERVALUE_ITEM *buffer);
Esempio n. 9
0
 public static extern PdhStatus PdhGetFormattedCounterValue(PdhCounter counter, PdhFmt dwFormat,
                                                            out int lpdwType, out PDH_FMT_COUNTERVALUE pValue);
Esempio n. 10
0
 public static extern unsafe PdhStatus PdhGetRawCounterArray(PdhCounter counter, ref int bufferSize,
                                                             out int itemCount, PDH_RAW_COUNTER_ITEM *buffer);
Esempio n. 11
0
 public static extern PdhStatus PdhAddEnglishCounter(PdhQuery query, string path, IntPtr userData,
                                                     out PdhCounter counter);
 public static unsafe PdhStatus GetFormattedCounterArray(
     this PdhCounter counter,
     ref int bufferSize,
     out int itemCount,
     PDH_FMT_COUNTERVALUE_ITEM *buffer)
 => PdhExports.PdhGetFormattedCounterArray(counter, DefaultFmt, ref bufferSize, out itemCount, buffer);
 public static unsafe PdhStatus GetRawCounterArray(
     this PdhCounter counter,
     ref int bufferSize,
     out int itemCount,
     PDH_RAW_COUNTER_ITEM *buffer)
 => PdhExports.PdhGetRawCounterArray(counter, ref bufferSize, out itemCount, buffer);
 private void Init()
 {
     Pdh.PdhOpenQuery(null, IntPtr.Zero, out pdhQuery).EnsureSuccess(nameof(Pdh.PdhOpenQuery));
     pdhCounter = pdhQuery.AddCounter(path);
 }