Ejemplo n.º 1
0
 /// <summary>
 /// <para>
 /// Initialize a new instance of the <see cref="ConnectionStringCollectionNode"/> class with a <see cref="InstanceDataCollection"/> object.
 /// </para>
 /// </summary>   
 /// <param name="instanceDataCollection">
 /// <para>A reference to the <see cref="InstanceDataCollection"/> runtime configuration.</para>
 /// </param>        
 public InstanceCollectionNode(InstanceDataCollection instanceDataCollection)
     : base()
 {
     if (instanceDataCollection == null)
     {
         throw new ArgumentNullException("instanceDataCollection");
     }
     this.instanceDataCollection = instanceDataCollection;
 }
 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;
 }
Ejemplo n.º 3
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);
        }
 public void CopyTo(InstanceDataCollection[] counters, int index)
 {
   Contract.Ensures(this.Dictionary.Values != null);
 }
 internal void Add(string counterName, InstanceDataCollection value)
 {
     object key = counterName.ToLower(CultureInfo.InvariantCulture);
     base.Dictionary.Add(key, value);
 }
 public void CopyTo(InstanceDataCollection[] counters, int index)
 {
     base.Dictionary.Values.CopyTo(counters, index);
 }
        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;
        }
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void CopyTo(InstanceDataCollection[] counters, int index) {
     Dictionary.Values.CopyTo((Array)counters, index);
 }
Ejemplo n.º 9
0
        internal void Add(string counterName, InstanceDataCollection value)
        {
            object objectName = counterName.ToLowerInvariant();

            Dictionary.Add(objectName, value);
        }
		public void CopyTo (InstanceDataCollection[] counters, int index)
		{
			Dictionary.CopyTo (counters, index);
		}
	// Copy the contents of this collection to an array.
	public void CopyTo(InstanceDataCollection[] array, int index)
			{
				((IDictionary)this).CopyTo(array, index);
			}
Ejemplo n.º 12
0
        internal void Add(string counterName, InstanceDataCollection value)
        {
            object key = counterName.ToLower(CultureInfo.InvariantCulture);

            base.Dictionary.Add(key, value);
        }