com.undefinedlabs.scope.rules.extractor.ScopeBenchmarkStatisticsExtractorResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scope-rule-java-jmh Show documentation
Show all versions of scope-rule-java-jmh Show documentation
Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly
identify, troubleshoot and fix failed builds.
This artifact contains the classes to instrument the Java JMH Benchmark Framework.
package com.undefinedlabs.scope.rules.extractor;
import java.util.HashMap;
import java.util.Map;
import org.openjdk.jmh.annotations.Mode;
public enum ScopeBenchmarkStatisticsExtractorResolver {
INSTANCE;
private final Map extractorByBenchmarkMode;
ScopeBenchmarkStatisticsExtractorResolver() {
this.extractorByBenchmarkMode = new HashMap<>();
this.extractorByBenchmarkMode.put(
Mode.SingleShotTime.shortLabel(), TimePerOpScopeBenchmarkStatisticsExtractor.INSTANCE);
this.extractorByBenchmarkMode.put(
Mode.SampleTime.shortLabel(), TimePerOpScopeBenchmarkStatisticsExtractor.INSTANCE);
this.extractorByBenchmarkMode.put(
Mode.AverageTime.shortLabel(), TimePerOpScopeBenchmarkStatisticsExtractor.INSTANCE);
this.extractorByBenchmarkMode.put(
Mode.Throughput.shortLabel(), OpsPerTimeScopeBenchmarkStatisticsExtractor.INSTANCE);
}
public ScopeBenchmarkStatisticsExtractor resolve(final Mode mode) {
if (mode == null) {
return NoopScopeBenchmarkStatisticsExtractor.INSTANCE;
}
return this.extractorByBenchmarkMode.get(mode.shortLabel()) != null
? this.extractorByBenchmarkMode.get(mode.shortLabel())
: NoopScopeBenchmarkStatisticsExtractor.INSTANCE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy