internal PerformanceCounterData(string name, string description, PerformanceCounterType counterType, PerformanceCounterActionMapping[] mappings)
 {
     this.Name = name;
     this.Description = description;
     this.CounterType = counterType;
     this.Mappings = mappings;
 }
Пример #2
0
        internal void SetInstanceName(String instanceName)
        {
            PerformanceCounterData[] data = s_DefaultPerformanceCounters;

            if (String.IsNullOrEmpty(instanceName))
            {
                try
                {
                    // The assert is safe here as we never give out the instance name.
                    new System.Security.Permissions.SecurityPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
                    Process       process    = Process.GetCurrentProcess();
                    ProcessModule mainModule = process.MainModule;
                    instanceName = mainModule.ModuleName;
                }
                finally
                {
                    System.Security.CodeAccessPermission.RevertAssert();
                }
            }

            this.m_instanceName = instanceName;

            // Build a mapping of PerformanceCounterActions to the actual actions that need
            // to be performed.  If this become a perf issue, we could build the default mapping
            // at build time.

            Dictionary <PerformanceCounterAction, List <PerformanceCounterStatement> > actionStatements = new Dictionary <PerformanceCounterAction, List <PerformanceCounterStatement> >();

            if (PerformanceCounterCategory.Exists(c_PerformanceCounterCategoryName))
            {
                for (int i = 0; i < data.Length; ++i)
                {
                    PerformanceCounterData currentData = data[i];
                    for (int j = 0; j < currentData.Mappings.Length; ++j)
                    {
                        PerformanceCounterActionMapping currentMapping = currentData.Mappings[j];
                        if (!actionStatements.ContainsKey(currentMapping.Action))
                        {
                            actionStatements.Add(currentMapping.Action, new List <PerformanceCounterStatement>());
                        }
                        List <PerformanceCounterStatement> lStatements  = actionStatements[currentMapping.Action];
                        PerformanceCounterStatement        newStatement = new PerformanceCounterStatement(CreateCounters(currentData.Name), currentMapping.Operation);
                        lStatements.Add(newStatement);
                    }
                }
            }

            this.m_actionStatements = actionStatements;
        }
 static PerformanceCounterManager()
 {
     PerformanceCounterData[]          dataArray = new PerformanceCounterData[20];
     PerformanceCounterActionMapping[] mappings  = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment) };
     dataArray[0] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCreatedName, ExecutionStringManager.PerformanceCounterSchedulesCreatedDescription, PerformanceCounterType.NumberOfItems64, mappings);
     PerformanceCounterActionMapping[] mappingArray2 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment) };
     dataArray[1] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCreatedRateName, ExecutionStringManager.PerformanceCounterSchedulesCreatedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray2);
     PerformanceCounterActionMapping[] mappingArray3 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Increment) };
     dataArray[2] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesUnloadedName, ExecutionStringManager.PerformanceCounterSchedulesUnloadedDescription, PerformanceCounterType.NumberOfItems64, mappingArray3);
     PerformanceCounterActionMapping[] mappingArray4 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Increment) };
     dataArray[3] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesUnloadedRateName, ExecutionStringManager.PerformanceCounterSchedulesUnloadedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray4);
     PerformanceCounterActionMapping[] mappingArray5 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment) };
     dataArray[4] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesLoadedName, ExecutionStringManager.PerformanceCounterSchedulesLoadedDescription, PerformanceCounterType.NumberOfItems64, mappingArray5);
     PerformanceCounterActionMapping[] mappingArray6 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment) };
     dataArray[5] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesLoadedRateName, ExecutionStringManager.PerformanceCounterSchedulesLoadedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray6);
     PerformanceCounterActionMapping[] mappingArray7 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Increment) };
     dataArray[6] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCompletedName, ExecutionStringManager.PerformanceCounterSchedulesCompletedDescription, PerformanceCounterType.NumberOfItems64, mappingArray7);
     PerformanceCounterActionMapping[] mappingArray8 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Increment) };
     dataArray[7] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCompletedRateName, ExecutionStringManager.PerformanceCounterSchedulesCompletedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray8);
     PerformanceCounterActionMapping[] mappingArray9 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Suspension, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Resumption, PerformanceCounterOperation.Decrement) };
     dataArray[8] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesSuspendedName, ExecutionStringManager.PerformanceCounterSchedulesSuspendedDescription, PerformanceCounterType.NumberOfItems64, mappingArray9);
     PerformanceCounterActionMapping[] mappingArray10 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Suspension, PerformanceCounterOperation.Increment) };
     dataArray[9] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesSuspendedRateName, ExecutionStringManager.PerformanceCounterSchedulesSuspendedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray10);
     PerformanceCounterActionMapping[] mappingArray11 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Increment) };
     dataArray[10] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesTerminatedName, ExecutionStringManager.PerformanceCounterSchedulesTerminatedDescription, PerformanceCounterType.NumberOfItems64, mappingArray11);
     PerformanceCounterActionMapping[] mappingArray12 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Increment) };
     dataArray[11] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesTerminatedRateName, ExecutionStringManager.PerformanceCounterSchedulesTerminatedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray12);
     PerformanceCounterActionMapping[] mappingArray13 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Decrement) };
     dataArray[12] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesInMemoryName, ExecutionStringManager.PerformanceCounterSchedulesInMemoryDescription, PerformanceCounterType.NumberOfItems64, mappingArray13);
     PerformanceCounterActionMapping[] mappingArray14 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Executing, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.NotExecuting, PerformanceCounterOperation.Decrement) };
     dataArray[13] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesExecutingName, ExecutionStringManager.PerformanceCounterSchedulesExecutingDescription, PerformanceCounterType.NumberOfItems64, mappingArray14);
     PerformanceCounterActionMapping[] mappingArray15 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Idle, PerformanceCounterOperation.Increment) };
     dataArray[14] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesIdleRateName, ExecutionStringManager.PerformanceCounterSchedulesIdleRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray15);
     PerformanceCounterActionMapping[] mappingArray16 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Runnable, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.NotExecuting, PerformanceCounterOperation.Decrement) };
     dataArray[15] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesRunnableName, ExecutionStringManager.PerformanceCounterSchedulesRunnableDescription, PerformanceCounterType.NumberOfItems64, mappingArray16);
     PerformanceCounterActionMapping[] mappingArray17 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Increment) };
     dataArray[0x10] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesAbortedName, ExecutionStringManager.PerformanceCounterSchedulesAbortedDescription, PerformanceCounterType.NumberOfItems64, mappingArray17);
     PerformanceCounterActionMapping[] mappingArray18 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Increment) };
     dataArray[0x11] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesAbortedRateName, ExecutionStringManager.PerformanceCounterSchedulesAbortedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray18);
     PerformanceCounterActionMapping[] mappingArray19 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Persisted, PerformanceCounterOperation.Increment) };
     dataArray[0x12] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesPersistedName, ExecutionStringManager.PerformanceCounterSchedulesPersistedDescription, PerformanceCounterType.NumberOfItems64, mappingArray19);
     PerformanceCounterActionMapping[] mappingArray20 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Persisted, PerformanceCounterOperation.Increment) };
     dataArray[0x13] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesPersistedRateName, ExecutionStringManager.PerformanceCounterSchedulesPersistedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray20);
     s_DefaultPerformanceCounters = dataArray;
 }
 static PerformanceCounterManager()
 {
     PerformanceCounterData[] dataArray = new PerformanceCounterData[20];
     PerformanceCounterActionMapping[] mappings = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment) };
     dataArray[0] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCreatedName, ExecutionStringManager.PerformanceCounterSchedulesCreatedDescription, PerformanceCounterType.NumberOfItems64, mappings);
     PerformanceCounterActionMapping[] mappingArray2 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment) };
     dataArray[1] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCreatedRateName, ExecutionStringManager.PerformanceCounterSchedulesCreatedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray2);
     PerformanceCounterActionMapping[] mappingArray3 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Increment) };
     dataArray[2] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesUnloadedName, ExecutionStringManager.PerformanceCounterSchedulesUnloadedDescription, PerformanceCounterType.NumberOfItems64, mappingArray3);
     PerformanceCounterActionMapping[] mappingArray4 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Increment) };
     dataArray[3] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesUnloadedRateName, ExecutionStringManager.PerformanceCounterSchedulesUnloadedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray4);
     PerformanceCounterActionMapping[] mappingArray5 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment) };
     dataArray[4] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesLoadedName, ExecutionStringManager.PerformanceCounterSchedulesLoadedDescription, PerformanceCounterType.NumberOfItems64, mappingArray5);
     PerformanceCounterActionMapping[] mappingArray6 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment) };
     dataArray[5] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesLoadedRateName, ExecutionStringManager.PerformanceCounterSchedulesLoadedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray6);
     PerformanceCounterActionMapping[] mappingArray7 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Increment) };
     dataArray[6] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCompletedName, ExecutionStringManager.PerformanceCounterSchedulesCompletedDescription, PerformanceCounterType.NumberOfItems64, mappingArray7);
     PerformanceCounterActionMapping[] mappingArray8 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Increment) };
     dataArray[7] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesCompletedRateName, ExecutionStringManager.PerformanceCounterSchedulesCompletedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray8);
     PerformanceCounterActionMapping[] mappingArray9 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Suspension, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Resumption, PerformanceCounterOperation.Decrement) };
     dataArray[8] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesSuspendedName, ExecutionStringManager.PerformanceCounterSchedulesSuspendedDescription, PerformanceCounterType.NumberOfItems64, mappingArray9);
     PerformanceCounterActionMapping[] mappingArray10 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Suspension, PerformanceCounterOperation.Increment) };
     dataArray[9] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesSuspendedRateName, ExecutionStringManager.PerformanceCounterSchedulesSuspendedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray10);
     PerformanceCounterActionMapping[] mappingArray11 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Increment) };
     dataArray[10] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesTerminatedName, ExecutionStringManager.PerformanceCounterSchedulesTerminatedDescription, PerformanceCounterType.NumberOfItems64, mappingArray11);
     PerformanceCounterActionMapping[] mappingArray12 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Increment) };
     dataArray[11] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesTerminatedRateName, ExecutionStringManager.PerformanceCounterSchedulesTerminatedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray12);
     PerformanceCounterActionMapping[] mappingArray13 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Creation, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Loading, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.Unloading, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Completion, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Termination, PerformanceCounterOperation.Decrement), new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Decrement) };
     dataArray[12] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesInMemoryName, ExecutionStringManager.PerformanceCounterSchedulesInMemoryDescription, PerformanceCounterType.NumberOfItems64, mappingArray13);
     PerformanceCounterActionMapping[] mappingArray14 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Executing, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.NotExecuting, PerformanceCounterOperation.Decrement) };
     dataArray[13] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesExecutingName, ExecutionStringManager.PerformanceCounterSchedulesExecutingDescription, PerformanceCounterType.NumberOfItems64, mappingArray14);
     PerformanceCounterActionMapping[] mappingArray15 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Idle, PerformanceCounterOperation.Increment) };
     dataArray[14] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesIdleRateName, ExecutionStringManager.PerformanceCounterSchedulesIdleRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray15);
     PerformanceCounterActionMapping[] mappingArray16 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Runnable, PerformanceCounterOperation.Increment), new PerformanceCounterActionMapping(PerformanceCounterAction.NotExecuting, PerformanceCounterOperation.Decrement) };
     dataArray[15] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesRunnableName, ExecutionStringManager.PerformanceCounterSchedulesRunnableDescription, PerformanceCounterType.NumberOfItems64, mappingArray16);
     PerformanceCounterActionMapping[] mappingArray17 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Increment) };
     dataArray[0x10] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesAbortedName, ExecutionStringManager.PerformanceCounterSchedulesAbortedDescription, PerformanceCounterType.NumberOfItems64, mappingArray17);
     PerformanceCounterActionMapping[] mappingArray18 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Aborted, PerformanceCounterOperation.Increment) };
     dataArray[0x11] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesAbortedRateName, ExecutionStringManager.PerformanceCounterSchedulesAbortedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray18);
     PerformanceCounterActionMapping[] mappingArray19 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Persisted, PerformanceCounterOperation.Increment) };
     dataArray[0x12] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesPersistedName, ExecutionStringManager.PerformanceCounterSchedulesPersistedDescription, PerformanceCounterType.NumberOfItems64, mappingArray19);
     PerformanceCounterActionMapping[] mappingArray20 = new PerformanceCounterActionMapping[] { new PerformanceCounterActionMapping(PerformanceCounterAction.Persisted, PerformanceCounterOperation.Increment) };
     dataArray[0x13] = new PerformanceCounterData(ExecutionStringManager.PerformanceCounterSchedulesPersistedRateName, ExecutionStringManager.PerformanceCounterSchedulesPersistedRateDescription, PerformanceCounterType.RateOfCountsPerSecond64, mappingArray20);
     s_DefaultPerformanceCounters = dataArray;
 }
        internal void SetInstanceName(string instanceName)
        {
            PerformanceCounterData[] dataArray = s_DefaultPerformanceCounters;
            if (string.IsNullOrEmpty(instanceName))
            {
                try
                {
                    new SecurityPermission(PermissionState.Unrestricted).Assert();
                    instanceName = Process.GetCurrentProcess().MainModule.ModuleName;
                }
                finally
                {
                    CodeAccessPermission.RevertAssert();
                }
            }
            this.m_instanceName = instanceName;
            Dictionary <PerformanceCounterAction, List <PerformanceCounterStatement> > dictionary = new Dictionary <PerformanceCounterAction, List <PerformanceCounterStatement> >();

            if (PerformanceCounterCategory.Exists(c_PerformanceCounterCategoryName))
            {
                for (int i = 0; i < dataArray.Length; i++)
                {
                    PerformanceCounterData data = dataArray[i];
                    for (int j = 0; j < data.Mappings.Length; j++)
                    {
                        PerformanceCounterActionMapping mapping = data.Mappings[j];
                        if (!dictionary.ContainsKey(mapping.Action))
                        {
                            dictionary.Add(mapping.Action, new List <PerformanceCounterStatement>());
                        }
                        List <PerformanceCounterStatement> list = dictionary[mapping.Action];
                        PerformanceCounterStatement        item = new PerformanceCounterStatement(this.CreateCounters(data.Name), mapping.Operation);
                        list.Add(item);
                    }
                }
            }
            this.m_actionStatements = dictionary;
        }
        internal PerformanceCounterData(
            String name,
            String description,
            PerformanceCounterType counterType,
            PerformanceCounterActionMapping[] mappings)
        {
            System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(name));
            System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(description));
            System.Diagnostics.Debug.Assert(mappings != null && mappings.Length != 0);

            this.Name = name;
            this.Description = description;
            this.CounterType = counterType;
            this.Mappings = mappings;
        }