protected CounterSetRegistrarBase(
            Guid providerId,
            Guid counterSetId,
            CounterSetInstanceType counterSetInstType,
            CounterInfo[] counterInfoArray,
            string counterSetName = null)
        {
            ProviderId         = providerId;
            CounterSetId       = counterSetId;
            CounterSetInstType = counterSetInstType;
            CounterSetName     = counterSetName;
            if ((counterInfoArray == null) ||
                (counterInfoArray.Length == 0))
            {
                throw new ArgumentNullException("counterInfoArray");
            }

            CounterInfoArray = new CounterInfo[counterInfoArray.Length];

            for (int i = 0; i < counterInfoArray.Length; i++)
            {
                CounterInfoArray[i] =
                    new CounterInfo(
                        counterInfoArray[i].Id,
                        counterInfoArray[i].Type,
                        counterInfoArray[i].Name
                        );
            }
            this._counterSetInstanceBase = null;
        }
 public PSCounterSetRegistrar(
     Guid providerId,
     Guid counterSetId,
     CounterSetInstanceType counterSetInstType,
     CounterInfo[] counterInfoArray,
     string counterSetName = null)
     : base(providerId, counterSetId, counterSetInstType, counterInfoArray, counterSetName)
 {
 }
 internal static bool ValidateCounterSetInstanceType(CounterSetInstanceType inCounterSetInstanceType)
 {
     foreach (CounterSetInstanceType DefinedCounterSetInstanceType in s_counterSetInstanceTypes)
     {
         if (DefinedCounterSetInstanceType == inCounterSetInstanceType)
         {
             return(true);
         }
     }
     return(false);
 }
 internal static bool ValidateCounterSetInstanceType(CounterSetInstanceType inCounterSetInstanceType)
 {
     foreach (CounterSetInstanceType type in s_counterSetInstanceTypes)
     {
         if (type == inCounterSetInstanceType)
         {
             return true;
         }
     }
     return false;
 }
Example #5
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>();
        }
Example #6
0
 protected CounterSetRegistrarBase(CounterSetRegistrarBase srcCounterSetRegistrarBase)
 {
     if (srcCounterSetRegistrarBase == null)
     {
         throw new ArgumentNullException("srcCounterSetRegistrarBase");
     }
     this._providerId             = srcCounterSetRegistrarBase._providerId;
     this._counterSetId           = srcCounterSetRegistrarBase._counterSetId;
     this._counterSetInstanceType = srcCounterSetRegistrarBase._counterSetInstanceType;
     this._counterSetName         = srcCounterSetRegistrarBase._counterSetName;
     CounterInfo[] infoArray = srcCounterSetRegistrarBase._counterInfoArray;
     this._counterInfoArray = new CounterInfo[infoArray.Length];
     for (int i = 0; i < infoArray.Length; i++)
     {
         this._counterInfoArray[i] = new CounterInfo(infoArray[i].Id, infoArray[i].Type, infoArray[i].Name);
     }
 }
Example #7
0
 protected CounterSetRegistrarBase(CounterSetRegistrarBase srcCounterSetRegistrarBase)
 {
     if (srcCounterSetRegistrarBase == null)
     {
         throw new ArgumentNullException("srcCounterSetRegistrarBase");
     }
     this._providerId = srcCounterSetRegistrarBase._providerId;
     this._counterSetId = srcCounterSetRegistrarBase._counterSetId;
     this._counterSetInstanceType = srcCounterSetRegistrarBase._counterSetInstanceType;
     this._counterSetName = srcCounterSetRegistrarBase._counterSetName;
     CounterInfo[] infoArray = srcCounterSetRegistrarBase._counterInfoArray;
     this._counterInfoArray = new CounterInfo[infoArray.Length];
     for (int i = 0; i < infoArray.Length; i++)
     {
         this._counterInfoArray[i] = new CounterInfo(infoArray[i].Id, infoArray[i].Type, infoArray[i].Name);
     }
 }
Example #8
0
 protected CounterSetRegistrarBase(Guid providerId, Guid counterSetId, CounterSetInstanceType counterSetInstType, CounterInfo[] counterInfoArray, string counterSetName = null)
 {
     this._providerId = providerId;
     this._counterSetId = counterSetId;
     this._counterSetInstanceType = counterSetInstType;
     this._counterSetName = counterSetName;
     if ((counterInfoArray == null) || (counterInfoArray.Length == 0))
     {
         throw new ArgumentNullException("counterInfoArray");
     }
     this._counterInfoArray = new CounterInfo[counterInfoArray.Length];
     for (int i = 0; i < counterInfoArray.Length; i++)
     {
         this._counterInfoArray[i] = new CounterInfo(counterInfoArray[i].Id, counterInfoArray[i].Type, counterInfoArray[i].Name);
     }
     this._counterSetInstanceBase = null;
 }
        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>();
        }
Example #10
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>();
 }
Example #11
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>();
 }
Example #12
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>();
        }
		static PSWorkflowPerformanceCounterSetInfo()
		{
			PSWorkflowPerformanceCounterSetInfo.ProviderId = new Guid("{5db760bc-64b2-4da7-b4ef-7dab105fbb8c}");
			PSWorkflowPerformanceCounterSetInfo.CounterSetId = new Guid("{faa17411-9025-4b86-8b5e-ce2f32b06e13}");
			PSWorkflowPerformanceCounterSetInfo.CounterSetType = CounterSetInstanceType.Multiple;
			CounterInfo[] counterInfo = new CounterInfo[29];
			counterInfo[0] = new CounterInfo(1, CounterType.RawData64);
			counterInfo[1] = new CounterInfo(2, CounterType.RateOfCountPerSecond64);
			counterInfo[2] = new CounterInfo(3, CounterType.RawData64);
			counterInfo[3] = new CounterInfo(4, CounterType.RateOfCountPerSecond64);
			counterInfo[4] = new CounterInfo(5, CounterType.RawData64);
			counterInfo[5] = new CounterInfo(6, CounterType.RateOfCountPerSecond64);
			counterInfo[6] = new CounterInfo(7, CounterType.RawData64);
			counterInfo[7] = new CounterInfo(8, CounterType.RateOfCountPerSecond64);
			counterInfo[8] = new CounterInfo(9, CounterType.RawData64);
			counterInfo[9] = new CounterInfo(10, CounterType.RateOfCountPerSecond64);
			counterInfo[10] = new CounterInfo(11, CounterType.RawData64);
			counterInfo[11] = new CounterInfo(12, CounterType.RateOfCountPerSecond64);
			counterInfo[12] = new CounterInfo(13, CounterType.RawData64);
			counterInfo[13] = new CounterInfo(14, CounterType.RateOfCountPerSecond64);
			counterInfo[14] = new CounterInfo(15, CounterType.RawData64);
			counterInfo[15] = new CounterInfo(16, CounterType.RawData64);
			counterInfo[16] = new CounterInfo(17, CounterType.RateOfCountPerSecond64);
			counterInfo[17] = new CounterInfo(18, CounterType.RawData64);
			counterInfo[18] = new CounterInfo(19, CounterType.RateOfCountPerSecond64);
			counterInfo[19] = new CounterInfo(20, CounterType.RawData64);
			counterInfo[20] = new CounterInfo(21, CounterType.RawData64);
			counterInfo[21] = new CounterInfo(22, CounterType.RawData64);
			counterInfo[22] = new CounterInfo(23, CounterType.RawData64);
			counterInfo[23] = new CounterInfo(24, CounterType.RawData64);
			counterInfo[24] = new CounterInfo(25, CounterType.RawData64);
			counterInfo[25] = new CounterInfo(26, CounterType.RawData64);
			counterInfo[26] = new CounterInfo(27, CounterType.RawData64);
			counterInfo[27] = new CounterInfo(28, CounterType.RawData64);
			counterInfo[28] = new CounterInfo(29, CounterType.RawData64);
			PSWorkflowPerformanceCounterSetInfo.CounterInfoArray = counterInfo;
		}
 static PSWorkflowPerformanceCounterSetInfo()
 {
     PSWorkflowPerformanceCounterSetInfo.ProviderId     = new Guid("{5db760bc-64b2-4da7-b4ef-7dab105fbb8c}");
     PSWorkflowPerformanceCounterSetInfo.CounterSetId   = new Guid("{faa17411-9025-4b86-8b5e-ce2f32b06e13}");
     PSWorkflowPerformanceCounterSetInfo.CounterSetType = CounterSetInstanceType.Multiple;
     CounterInfo[] counterInfo = new CounterInfo[29];
     counterInfo[0]  = new CounterInfo(1, CounterType.RawData64);
     counterInfo[1]  = new CounterInfo(2, CounterType.RateOfCountPerSecond64);
     counterInfo[2]  = new CounterInfo(3, CounterType.RawData64);
     counterInfo[3]  = new CounterInfo(4, CounterType.RateOfCountPerSecond64);
     counterInfo[4]  = new CounterInfo(5, CounterType.RawData64);
     counterInfo[5]  = new CounterInfo(6, CounterType.RateOfCountPerSecond64);
     counterInfo[6]  = new CounterInfo(7, CounterType.RawData64);
     counterInfo[7]  = new CounterInfo(8, CounterType.RateOfCountPerSecond64);
     counterInfo[8]  = new CounterInfo(9, CounterType.RawData64);
     counterInfo[9]  = new CounterInfo(10, CounterType.RateOfCountPerSecond64);
     counterInfo[10] = new CounterInfo(11, CounterType.RawData64);
     counterInfo[11] = new CounterInfo(12, CounterType.RateOfCountPerSecond64);
     counterInfo[12] = new CounterInfo(13, CounterType.RawData64);
     counterInfo[13] = new CounterInfo(14, CounterType.RateOfCountPerSecond64);
     counterInfo[14] = new CounterInfo(15, CounterType.RawData64);
     counterInfo[15] = new CounterInfo(16, CounterType.RawData64);
     counterInfo[16] = new CounterInfo(17, CounterType.RateOfCountPerSecond64);
     counterInfo[17] = new CounterInfo(18, CounterType.RawData64);
     counterInfo[18] = new CounterInfo(19, CounterType.RateOfCountPerSecond64);
     counterInfo[19] = new CounterInfo(20, CounterType.RawData64);
     counterInfo[20] = new CounterInfo(21, CounterType.RawData64);
     counterInfo[21] = new CounterInfo(22, CounterType.RawData64);
     counterInfo[22] = new CounterInfo(23, CounterType.RawData64);
     counterInfo[23] = new CounterInfo(24, CounterType.RawData64);
     counterInfo[24] = new CounterInfo(25, CounterType.RawData64);
     counterInfo[25] = new CounterInfo(26, CounterType.RawData64);
     counterInfo[26] = new CounterInfo(27, CounterType.RawData64);
     counterInfo[27] = new CounterInfo(28, CounterType.RawData64);
     counterInfo[28] = new CounterInfo(29, CounterType.RawData64);
     PSWorkflowPerformanceCounterSetInfo.CounterInfoArray = counterInfo;
 }
Example #15
0
 public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
 {
     throw new NotImplementedException();
 }
 public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
 {
 }
 public CounterSet(Guid providerGuid, Guid counterSetGuid, CounterSetInstanceType instanceType)
 {
 }
Example #18
0
 public PSCounterSetRegistrar(
     Guid providerId,
     Guid counterSetId,
     CounterSetInstanceType counterSetInstType,
     CounterInfo[] counterInfoArray,
     string counterSetName = null)
     : base(providerId, counterSetId, counterSetInstType, counterInfoArray, counterSetName)
 {
 }