//------------------------------------------------------------------------------ // // Method: LogIntervalOverCountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an interval metric per occurrence of a count metric to the console. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> protected override void LogIntervalOverCountAggregate(MetricAggregateContainer <IntervalMetric, CountMetric> metricAggregate, long totalInterval, long totalInstances) { if (totalInstances != 0) { double aggregateValue = Convert.ToDouble(totalInterval) / totalInstances; console.WriteLine(metricAggregate.Name + separatorString + aggregateValue); } }
//------------------------------------------------------------------------------ // // Method: LogIntervalOverTotalRunTimeAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an interval metric as a fraction of the total runtime of the logger to the console. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalRunTime">The total run time of the logger since starting in milliseonds.</param> protected override void LogIntervalOverTotalRunTimeAggregate(MetricAggregateContainer <IntervalMetric> metricAggregate, long totalInterval, long totalRunTime) { if (totalRunTime > 0) { double aggregateValue = Convert.ToDouble(totalInterval) / totalRunTime; console.WriteLine(metricAggregate.Name + separatorString + aggregateValue); } }
//------------------------------------------------------------------------------ // // Method: LogAmountOverTimeUnitAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an amount metric within the specified time unit to the console. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalAmount">The total of the amount metric.</param> /// <param name="totalElapsedTimeUnits">The total elapsed time units.</param> protected override void LogAmountOverTimeUnitAggregate(MetricAggregateContainer <AmountMetric> metricAggregate, long totalAmount, long totalElapsedTimeUnits) { if (totalElapsedTimeUnits != 0) { double aggregateValue = Convert.ToDouble(totalAmount) / totalElapsedTimeUnits; console.WriteLine(metricAggregate.Name + separatorString + aggregateValue); } }
//------------------------------------------------------------------------------ // // Method: LogAmountOverAmountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an amount metric divided by the total of another amount metric to the console. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="numeratorTotal">The total of the numerator amount metric.</param> /// <param name="denominatorTotal">The total of the denominator amount metric.</param> protected override void LogAmountOverAmountAggregate(MetricAggregateContainer <AmountMetric, AmountMetric> metricAggregate, long numeratorTotal, long denominatorTotal) { if (denominatorTotal != 0) { double aggregateValue = Convert.ToDouble(numeratorTotal) / denominatorTotal; console.WriteLine(metricAggregate.Name + separatorString + aggregateValue); } }
//------------------------------------------------------------------------------ // // Method: LogAmountOverAmountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an amount metric divided by the total of another amount metric to a performance counter. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="numeratorTotal">The total of the numerator amount metric.</param> /// <param name="denominatorTotal">The total of the denominator amount metric.</param> protected override void LogAmountOverAmountAggregate(MetricAggregateContainer <AmountMetric, AmountMetric> metricAggregate, long numeratorTotal, long denominatorTotal) { if (denominatorTotal != 0) { registeredMetricsPerformanceCounters[metricAggregate.Name].RawValue = numeratorTotal; registeredMetricsPerformanceCounters[CounterNameAppendBase(metricAggregate.Name)].RawValue = denominatorTotal; } }
//------------------------------------------------------------------------------ // // Method: LogIntervalOverTotalRunTimeAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an interval metric as a fraction of the total runtime of the logger to a performance counter. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalRunTime">The total run time of the logger since starting in milliseonds.</param> protected override void LogIntervalOverTotalRunTimeAggregate(MetricAggregateContainer <IntervalMetric> metricAggregate, long totalInterval, long totalRunTime) { if (totalRunTime > 0) { registeredMetricsPerformanceCounters[metricAggregate.Name].RawValue = totalInterval; registeredMetricsPerformanceCounters[CounterNameAppendBase(metricAggregate.Name)].RawValue = totalRunTime; } }
//------------------------------------------------------------------------------ // // Method: LogIntervalOverCountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an interval metric per occurrence of a count metric to a performance counter. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> protected override void LogIntervalOverCountAggregate(MetricAggregateContainer <IntervalMetric, CountMetric> metricAggregate, long totalInterval, long totalInstances) { if (totalInstances != 0) { registeredMetricsPerformanceCounters[metricAggregate.Name].RawValue = Convert.ToInt64(Convert.ToDouble(totalInterval) / totalInstances); registeredMetricsPerformanceCounters[CounterNameAppendInstantaneous(metricAggregate.Name)].RawValue = totalInterval; registeredMetricsPerformanceCounters[CounterNameAppendInstantaneousBase(metricAggregate.Name)].RawValue = totalInstances; } }
//------------------------------------------------------------------------------ // // Method: LogAmountOverTimeUnitAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an amount metric within the specified time unit to a performance counter. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalAmount">The total of the amount metric.</param> /// <param name="totalElapsedTimeUnits">The total elapsed time units.</param> protected override void LogAmountOverTimeUnitAggregate(MetricAggregateContainer <AmountMetric> metricAggregate, long totalAmount, long totalElapsedTimeUnits) { if (totalElapsedTimeUnits != 0) { registeredMetricsPerformanceCounters[metricAggregate.Name].RawValue = Convert.ToInt64(Convert.ToDouble(totalAmount) / totalElapsedTimeUnits); registeredMetricsPerformanceCounters[CounterNameAppendInstantaneous(metricAggregate.Name)].RawValue = totalAmount; // If the time unit of the aggregate is not second, the instantaneous counter is of type AverageCount64 which requires a base counter... if (metricAggregate.DenominatorTimeUnit != TimeUnit.Second) { registeredMetricsPerformanceCounters[CounterNameAppendInstantaneousBase(metricAggregate.Name)].RawValue = totalElapsedTimeUnits; } } }
//------------------------------------------------------------------------------ // // Method: LogCountOverTimeUnitAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the number of occurrences of a count metric within the specified time unit to a performance counter. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> /// <param name="totalElapsedTimeUnits">The total elapsed time units.</param> protected override void LogCountOverTimeUnitAggregate(MetricAggregateContainer <CountMetric> metricAggregate, long totalInstances, long totalElapsedTimeUnits) { // If no time units have elapsed, do not log (to prevent divide by 0 error below) if (totalElapsedTimeUnits != 0) { registeredMetricsPerformanceCounters[metricAggregate.Name].RawValue = Convert.ToInt64(Convert.ToDouble(totalInstances) / totalElapsedTimeUnits); registeredMetricsPerformanceCounters[CounterNameAppendInstantaneous(metricAggregate.Name)].RawValue = totalInstances; // If the time unit of the aggregate is not second, the instantaneous counter is of type AverageCount64 which requires a base counter... if (metricAggregate.DenominatorTimeUnit != TimeUnit.Second) { registeredMetricsPerformanceCounters[CounterNameAppendInstantaneousBase(metricAggregate.Name)].RawValue = totalElapsedTimeUnits; } } }
//------------------------------------------------------------------------------ // // Method: LogIntervalOverTotalRunTimeAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an interval metric as a fraction of the total runtime of the logger. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalRunTime">The total run time of the logger since starting in milliseconds.</param> protected abstract void LogIntervalOverTotalRunTimeAggregate(MetricAggregateContainer <IntervalMetric> metricAggregate, long totalInterval, long totalRunTime);
//------------------------------------------------------------------------------ // // Method: LogIntervalOverCountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an interval metric per occurrence of a count metric. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInterval">The total of the interval metric.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> protected abstract void LogIntervalOverCountAggregate(MetricAggregateContainer <IntervalMetric, CountMetric> metricAggregate, long totalInterval, long totalInstances);
//------------------------------------------------------------------------------ // // Method: LogAmountOverAmountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an amount metric divided by the total of another amount metric. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="numeratorTotal">The total of the numerator amount metric.</param> /// <param name="denominatorTotal">The total of the denominator amount metric.</param> protected abstract void LogAmountOverAmountAggregate(MetricAggregateContainer <AmountMetric, AmountMetric> metricAggregate, long numeratorTotal, long denominatorTotal);
//------------------------------------------------------------------------------ // // Method: LogAmountOverTimeUnitAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate respresenting the total of an amount metric within the specified time unit. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalAmount">The total of the amount metric.</param> /// <param name="totalElapsedTimeUnits">The total elapsed time units.</param> protected abstract void LogAmountOverTimeUnitAggregate(MetricAggregateContainer <AmountMetric> metricAggregate, long totalAmount, long totalElapsedTimeUnits);
//------------------------------------------------------------------------------ // // Method: LogAmountOverCountAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the total of an amount metric per occurrence of a count metric. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalAmount">The total of the amount metric.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> protected abstract void LogAmountOverCountAggregate(MetricAggregateContainer <AmountMetric, CountMetric> metricAggregate, long totalAmount, long totalInstances);
//------------------------------------------------------------------------------ // // Method: LogCountOverTimeUnitAggregate // //------------------------------------------------------------------------------ /// <summary> /// Logs a metric aggregate representing the number of occurrences of a count metric within the specified time unit. /// </summary> /// <param name="metricAggregate">The metric aggregate to log.</param> /// <param name="totalInstances">The number of occurrences of the count metric.</param> /// <param name="totalElapsedTimeUnits">The total elapsed time units.</param> protected abstract void LogCountOverTimeUnitAggregate(MetricAggregateContainer <CountMetric> metricAggregate, long totalInstances, long totalElapsedTimeUnits);