internal InstanceDataCollection ReadInstanceData(string counterName)
 {
     InstanceDataCollection datas = new InstanceDataCollection(counterName);
     string[] array = new string[this.categorySample.InstanceNameTable.Count];
     this.categorySample.InstanceNameTable.Keys.CopyTo(array, 0);
     int[] numArray = new int[this.categorySample.InstanceNameTable.Count];
     this.categorySample.InstanceNameTable.Values.CopyTo(numArray, 0);
     for (int i = 0; i < array.Length; i++)
     {
         long baseValue = 0L;
         if (this.BaseCounterDefinitionSample != null)
         {
             int index = (int) this.BaseCounterDefinitionSample.categorySample.InstanceNameTable[array[i]];
             baseValue = this.BaseCounterDefinitionSample.instanceValues[index];
         }
         CounterSample sample = new CounterSample(this.instanceValues[numArray[i]], baseValue, this.categorySample.CounterFrequency, this.categorySample.SystemFrequency, this.categorySample.TimeStamp, this.categorySample.TimeStamp100nSec, (PerformanceCounterType) this.CounterType, this.categorySample.CounterTimeStamp);
         datas.Add(array[i], new InstanceData(array[i], sample));
     }
     return datas;
 }
Exemplo n.º 2
0
        internal InstanceDataCollection ReadInstanceData(string counterName)
        {
            InstanceDataCollection datas = new InstanceDataCollection(counterName);

            string[] array = new string[this.categorySample.InstanceNameTable.Count];
            this.categorySample.InstanceNameTable.Keys.CopyTo(array, 0);
            int[] numArray = new int[this.categorySample.InstanceNameTable.Count];
            this.categorySample.InstanceNameTable.Values.CopyTo(numArray, 0);
            for (int i = 0; i < array.Length; i++)
            {
                long baseValue = 0L;
                if (this.BaseCounterDefinitionSample != null)
                {
                    int index = (int)this.BaseCounterDefinitionSample.categorySample.InstanceNameTable[array[i]];
                    baseValue = this.BaseCounterDefinitionSample.instanceValues[index];
                }
                CounterSample sample = new CounterSample(this.instanceValues[numArray[i]], baseValue, this.categorySample.CounterFrequency, this.categorySample.SystemFrequency, this.categorySample.TimeStamp, this.categorySample.TimeStamp100nSec, (PerformanceCounterType)this.CounterType, this.categorySample.CounterTimeStamp);
                datas.Add(array[i], new InstanceData(array[i], sample));
            }
            return(datas);
        }
        internal InstanceDataCollection ReadInstanceData(string counterName) {
#pragma warning disable 618
            InstanceDataCollection data = new InstanceDataCollection(counterName);
#pragma warning restore 618

            string[] keys = new string[categorySample.InstanceNameTable.Count];
            categorySample.InstanceNameTable.Keys.CopyTo(keys, 0);
            int[] indexes = new int[categorySample.InstanceNameTable.Count];
            categorySample.InstanceNameTable.Values.CopyTo(indexes, 0);
            for (int index = 0; index < keys.Length; ++ index) {
                long baseValue = 0;
                if (this.BaseCounterDefinitionSample != null) {
                    CategorySample baseCategorySample = this.BaseCounterDefinitionSample.categorySample;
                    int baseIndex = (int)baseCategorySample.InstanceNameTable[keys[index]];
                    baseValue = this.BaseCounterDefinitionSample.instanceValues[baseIndex];
                }

                CounterSample sample = new CounterSample(this.instanceValues[indexes[index]],
                                                        baseValue,
                                                        categorySample.CounterFrequency,
                                                        categorySample.SystemFrequency,
                                                        categorySample.TimeStamp,
                                                        categorySample.TimeStamp100nSec,
                                                        (PerformanceCounterType)this.CounterType,
                                                        categorySample.CounterTimeStamp);

                data.Add(keys[index], new InstanceData(keys[index], sample));
            }

            return data;
        }