private void Init()
 {
     query = PdhQueryHandle.OpenRealtime();
     for (var i = 0; i < counters.Length; ++i)
     {
         ref var c = ref counters[i];
         c.PdhCounter = query.AddCounter(c.Category, c.Counter, c.Instance, false);
     }
        public T Observe()
        {
            try
            {
                return(RawObserve());
            }
            catch (PdhException e)
            {
                switch (e.Status)
                {
                case PdhStatus.PDH_CALC_NEGATIVE_VALUE:
                case PdhStatus.PDH_CALC_NEGATIVE_TIMEBASE:
                case PdhStatus.PDH_CALC_NEGATIVE_DENOMINATOR:
                    Dispose();
                    query            = null;
                    firstObservation = true;
                    return(Factory.Create <T>());

                default:
                    throw;
                }
            }
        }