示例#1
0
        /// <summary>
        /// Add the specified PerfCounterMetricSample object to the collection
        /// </summary>
        /// <param name="newPerfCounterMetricSample">The new PerfCounterMetricSample object to add</param>
        public void Add(PerfCounterMetricSample newPerfCounterMetricSample)
        {
            if (newPerfCounterMetricSample == null)
            {
                throw new ArgumentNullException(nameof(newPerfCounterMetricSample), "A new performance counter metric sample object must be provided to add it to the collection.");
            }

            //our base object does all the work
            base.Add(newPerfCounterMetricSample);
        }
示例#2
0
        /// <summary>
        /// Add a new performance counter metric sample from the specified sample packet
        /// </summary>
        /// <param name="newMetricSamplePacket">The sample packet to create a new metric sample object from</param>
        internal PerfCounterMetricSample Add(PerfCounterMetricSamplePacket newMetricSamplePacket)
        {
            if (newMetricSamplePacket == null)
            {
                throw new ArgumentNullException(nameof(newMetricSamplePacket), "A new performance counter metric sample packet object must be provided to add it to the collection.");
            }

            //now we have to create a new sample object to wrap the provided packet
            PerfCounterMetricSample newPerfCounterMetricSample = new PerfCounterMetricSample(m_PerfCounterMetric, newMetricSamplePacket);

            //and forward to our normal add routine
            Add(newPerfCounterMetricSample);

            //returning our new wrapped object
            return(newPerfCounterMetricSample);
        }