internal void Internalize(SampledMetric metric) { lock (m_Lock) { Monitor.CustomSampledMetric internalMetric = metric.WrappedMetric; m_Externalized[internalMetric] = metric; } }
internal SampledMetric Externalize(Monitor.CustomSampledMetric eventMetric) { if (eventMetric == null) { return(null); } lock (m_Lock) { SampledMetric externalDefinition; if (m_Externalized.TryGetValue(eventMetric, out externalDefinition) == false) { externalDefinition = new SampledMetric(m_MetricDefinition, eventMetric); m_Externalized[eventMetric] = externalDefinition; } return(externalDefinition); } }
/// <summary> /// Create a new API custom sampled metric object from the provided API custom sampled metric definition and internal custom sampled metric. /// </summary> /// <remarks>The new metric will automatically be added to the metric definition's metrics collection.</remarks> /// <param name="definition">The API custom sampled metric definition for the metric instance.</param> /// <param name="metric">The internal custom sampled metric to wrap.</param> internal SampledMetric(SampledMetricDefinition definition, Monitor.CustomSampledMetric metric) { m_MetricDefinition = definition; m_WrappedMetric = metric; }