Created
October 1, 2024 23:30
-
-
Save yjbanov/4639cffa4eec6db95a6fa0001c0cfe45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class BenchmarkMetricComputation { | |
const BenchmarkMetricComputation(this.name); | |
final String name; | |
/// The name for the computed value tracking the average value of the measured | |
/// samples without outliers. | |
static const NamedMetricComputation average = NamedMetricComputation('average'); | |
/// The name for the computed value tracking the average of outlier samples. | |
static const NamedMetricComputation outlierAverage = NamedMetricComputation('outlierAverage'); | |
/// The name for the computed value tracking the outlier average divided by | |
/// the clean average. | |
static const NamedMetricComputation outlierRatio = NamedMetricComputation('outlierRatio'); | |
/// The name for the computed value tracking the noise as a multiple of the | |
/// [average] value takes from clean samples. | |
static const NamedMetricComputation noise = NamedMetricComputation('noise'); | |
/// The name for the computed value tracking the 50th percentile value from | |
/// the samples with outliers. | |
static const PercentileMetricComputation p50 = PercentileMetricComputation('p50', 0.5); | |
/// The name for the computed value tracking the 90th percentile value from | |
/// the samples with outliers. | |
static const PercentileMetricComputation p90 = PercentileMetricComputation('p90', 0.9); | |
/// The name for the computed value tracking the 95th percentile value from | |
/// the samples with outliers. | |
static const PercentileMetricComputation p95 = PercentileMetricComputation('p95', 0.95); | |
static const List<BenchmarkMetricComputation> values = <BenchmarkMetricComputation>[ | |
average, | |
outlierAverage, | |
outlierRatio, | |
noise, | |
p50, | |
p90, | |
p95, | |
]; | |
} | |
final class NamedMetricComputation extends BenchmarkMetricComputation { | |
const NamedMetricComputation(super.name); | |
} | |
final class PercentileMetricComputation extends BenchmarkMetricComputation { | |
const PercentileMetricComputation(super.name, this.percentile); | |
final double percentile; | |
static const List<PercentileMetricComputation> values = <PercentileMetricComputation>[ | |
BenchmarkMetricComputation.p50, | |
BenchmarkMetricComputation.p90, | |
BenchmarkMetricComputation.p95, | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment