Exemplo n.º 1
0
        /// <summary>Gets diagnosers the metric values.</summary>
        /// <param name="metric">The metric to get diagnosers for.</param>
        /// <returns>Diagnosers for the metric values</returns>
        public IDiagnoser[] GetDiagnosers(MetricInfo metric)
        {
            Code.NotNull(metric, nameof(metric));
            Code.AssertArgument(
                metric.ValuesProvider == this, nameof(metric),
                "Passed ValuesProvider does not match to this one.");

            return(GetDiagnosersOverride(metric));
        }
Exemplo n.º 2
0
        /// <summary>Creates the column provider for the metric columns.</summary>
        /// <param name="metric">The metric to get columns for.</param>
        /// <param name="columns">The columns to include.</param>
        /// <returns>Column provider for the metric columns</returns>
        protected static IColumnProvider CreateColumnProvider([NotNull] MetricInfo metric, MetricValueColumns columns)
        {
            var resultColumns = _columnKinds
                                .Where(p => columns.IsFlagSet(p.Key))
                                .Select(p => (IColumn) new MetricValueColumn(metric, p.Value))
                                .ToArray();

            return(new SimpleColumnProvider(resultColumns));
        }
Exemplo n.º 3
0
        /// <summary>Gets column provider for the metric values.</summary>
        /// <param name="metric">The metric to get column for.</param>
        /// <returns>Column provider for the metric values</returns>
        public IColumnProvider GetColumnProvider(MetricInfo metric)
        {
            Code.NotNull(metric, nameof(metric));
            Code.AssertArgument(
                metric.ValuesProvider == this, nameof(metric),
                "Passed ValuesProvider does not match to this one.");

            return(GetColumnProviderOverride(metric));
        }
Exemplo n.º 4
0
        /// <summary>Gets column provider for the metric values.</summary>
        /// <param name="metric">The metric to get columns for.</param>
        /// <param name="columns">The columns to include.</param>
        /// <returns>Column provider for the metric values</returns>
        public IColumnProvider GetColumnProvider(MetricInfo metric, MetricValueColumns columns)
        {
            Code.NotNull(metric, nameof(metric));
            EnumCode.FlagsDefined(columns, nameof(columns));
            Code.AssertArgument(
                metric.ValuesProvider == this, nameof(metric),
                "Passed ValuesProvider does not match to this one.");

            return(GetColumnProviderOverride(metric, columns));
        }
Exemplo n.º 5
0
        /// <summary>Gets column provider for the metric values.</summary>
        /// <param name="metric">The metric to get column for.</param>
        /// <returns>Column provider for the metric values</returns>
        protected virtual IColumnProvider GetColumnProviderOverride(MetricInfo metric)
        {
            if (metric.ReportVariance)
            {
                return(new SimpleColumnProvider(
                           new MetricValueColumn(metric, MetricValueColumn.Kind.Value),
                           new MetricValueColumn(metric, MetricValueColumn.Kind.StdDev)));
            }

            return(new SimpleColumnProvider(
                       new MetricValueColumn(metric, MetricValueColumn.Kind.Value)));
        }
Exemplo n.º 6
0
        /// <summary>Gets column provider for the metric values.</summary>
        /// <param name="metric">The metric to get columns for.</param>
        /// <param name="columns">The columns to include.</param>
        /// <returns>Column provider for the metric values</returns>
        protected virtual IColumnProvider GetColumnProviderOverride(MetricInfo metric, MetricValueColumns columns)
        {
            if (columns == MetricValueColumns.Auto)
            {
                columns = metric.MetricColumns;
            }

            if (columns == MetricValueColumns.Auto)
            {
                columns = MetricValueColumns.Mean;
            }

            return(CreateColumnProvider(metric, columns));
        }
 /// <summary>Gets diagnosers the metric values.</summary>
 /// <param name="metric">The metric to get diagnosers for.</param>
 /// <returns>Diagnosers for the metric values</returns>
 protected override IDiagnoser[] GetDiagnosersOverride(MetricInfo metric) =>
 Array <IDiagnoser> .Empty;
Exemplo n.º 8
0
 // TODO: better name
 /// <summary>Gets diagnosers the metric values.</summary>
 /// <param name="metric">The metric to get diagnosers for.</param>
 /// <returns>Diagnosers for the metric values</returns>
 protected abstract IDiagnoser[] GetDiagnosersOverride(MetricInfo metric);
 /// <summary>Gets diagnosers the metric values.</summary>
 /// <param name="metric">The metric to get diagnosers for.</param>
 /// <returns>Diagnosers for the metric values</returns>
 protected override IDiagnoser[] GetDiagnosersOverride(MetricInfo metric) =>
 new IDiagnoser[]
 {
     MemoryDiagnoserNoColumns.Default
 };
Exemplo n.º 10
0
 /// <summary>Returns minimum metric value.</summary>
 /// <param name="metricMaxValue">The maximum metric value.</param>
 /// <param name="metric">The metric information.</param>
 /// <returns>Minimum metric value.</returns>
 public static double GetMinMetricValue(
     this double metricMaxValue,
     [NotNull] MetricInfo metric) =>
 GetMinMetricValue(metricMaxValue, metric.SingleValueMode);
Exemplo n.º 11
0
 /// <summary>Determines if the minimum metric value should be stored.</summary>
 /// <param name="metricRange">The metric range.</param>
 /// <param name="metricUnit">The metric unit.</param>
 /// <param name="metric">The metric information.</param>
 /// <returns><c>true</c>, if the minimum metric value should be stored.</returns>
 public static bool ShouldStoreMinMetricValue(
     this MetricRange metricRange, MetricUnit metricUnit,
     [NotNull] MetricInfo metric) =>
 ShouldStoreMinMetricValue(metricRange, metricUnit, metric.SingleValueMode);
Exemplo n.º 12
0
 /// <summary>Determines if the minimum metric value should be stored.</summary>
 /// <param name="metricRange">The metric range.</param>
 /// <param name="metricUnit">The metric unit.</param>
 /// <param name="metric">The metric information.</param>
 /// <returns><c>true</c>, if the minimum metric value should be stored.</returns>
 public static bool ShouldStoreMinMetricValue(
     this MetricRange metricRange, MetricUnit metricUnit,
     [NotNull] MetricInfo metric) =>
 ShouldStoreMinMetricValue(metricRange, metricUnit, metric.DefaultMinValue);
Exemplo n.º 13
0
 /// <summary>Returns minimum metric value.</summary>
 /// <param name="metricMaxValue">The maximum metric value.</param>
 /// <param name="metric">The metric information.</param>
 /// <returns>Minimum metric value.</returns>
 public static double GetMinMetricValue(this double metricMaxValue, [NotNull] MetricInfo metric) =>
 GetMinMetricValue(metricMaxValue, metric.DefaultMinValue);
Exemplo n.º 14
0
 /// <summary>Returns minimum metric value.</summary>
 /// <param name="metricMaxValue">The maximum metric value.</param>
 /// <param name="metricAttributeType">Type of the metric attribute.</param>
 /// <returns>Minimum metric value.</returns>
 public static double GetMinMetricValue(this double metricMaxValue, [NotNull] Type metricAttributeType) =>
 GetMinMetricValue(metricMaxValue, MetricInfo.FromAttribute(metricAttributeType));