/// <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); }
/// <summary> /// Create a new performance counter metric sample object for the provided metric and raw sample packet. /// </summary> /// <remarks>The metric sample is automatically added to the samples collection of the provided metric object.</remarks> /// <param name="metric">The metric object this sample applies to.</param> /// <param name="metricSamplePacket">The raw sample data packet.</param> internal PerfCounterMetricSample(PerfCounterMetric metric, PerfCounterMetricSamplePacket metricSamplePacket) : base(metric, metricSamplePacket, ((PerfCounterMetricDefinition)metric.Definition).RequiresMultipleSamples) { }