Пример #1
0
        /// <summary>
        /// CounterSet constructor.
        /// </summary>
        /// <param name="providerGuid">ProviderGuid identifies the provider application. A provider identified by ProviderGuid could publish several CounterSets defined by different CounterSetGuids</param>
        /// <param name="counterSetGuid">CounterSetGuid identifies the specific CounterSet. CounterSetGuid should be unique.</param>
        /// <param name="instanceType">One of defined CounterSetInstanceType values</param>
        public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
        {
            if (!PerfProviderCollection.ValidateCounterSetInstanceType(instanceType))
            {
                throw new ArgumentException(SR.Format(SR.Perflib_Argument_InvalidCounterSetInstanceType, instanceType), nameof(instanceType));
            }

            _providerGuid = providerGuid;
            _counterSet   = counterSetGuid;
            _instType     = instanceType;
            PerfProviderCollection.RegisterCounterSet(_counterSet);
            _provider    = PerfProviderCollection.QueryProvider(_providerGuid);
            _lockObject  = new object();
            _stringToId  = new Dictionary <string, int>();
            _idToCounter = new Dictionary <int, CounterType>();
        }
Пример #2
0
 public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
 {
     if (s_platformNotSupported)
     {
         throw new PlatformNotSupportedException(System.SR.GetString("Perflib_PlatformNotSupported"));
     }
     if (!PerfProviderCollection.ValidateCounterSetInstanceType(instanceType))
     {
         throw new ArgumentException(System.SR.GetString("Perflib_Argument_InvalidCounterSetInstanceType", new object[] { instanceType }), "instanceType");
     }
     this.m_providerGuid = providerGuid;
     this.m_counterSet   = counterSetGuid;
     this.m_instType     = instanceType;
     PerfProviderCollection.RegisterCounterSet(this.m_counterSet);
     this.m_provider    = PerfProviderCollection.QueryProvider(this.m_providerGuid);
     this.m_lockObject  = new object();
     this.m_stringToId  = new Dictionary <string, int>();
     this.m_idToCounter = new Dictionary <int, CounterType>();
 }
Пример #3
0
        public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
        {
            // Check only the mayor version, only support Windows Vista and later.
            //
            if (s_platformNotSupported)
            {
                throw new System.PlatformNotSupportedException(SR.GetString(SR.Perflib_PlatformNotSupported));
            }
            if (!PerfProviderCollection.ValidateCounterSetInstanceType(instanceType))
            {
                throw new ArgumentException(SR.GetString(SR.Perflib_Argument_InvalidCounterSetInstanceType, instanceType), "instanceType");
            }

            m_providerGuid = providerGuid;
            m_counterSet   = counterSetGuid;
            m_instType     = instanceType;
            PerfProviderCollection.RegisterCounterSet(m_counterSet);
            m_provider    = PerfProviderCollection.QueryProvider(m_providerGuid);
            m_lockObject  = new Object();
            m_stringToId  = new Dictionary <String, Int32>();
            m_idToCounter = new Dictionary <Int32, CounterType>();
        }