本文整理汇总了Java中org.openjdk.jmh.infra.IterationParams类的典型用法代码示例。如果您正苦于以下问题:Java IterationParams类的具体用法?Java IterationParams怎么用?Java IterationParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IterationParams类属于org.openjdk.jmh.infra包,在下文中一共展示了IterationParams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams,
IterationParams iterationParams,
IterationResult result) {
final ArrayList<Result> results = Lists.newArrayList();
if (metricRegistry == null) {
return results;
}
final SortedMap<String, Meter> counters = metricRegistry.getMeters((name, metric) -> {
return name.startsWith(MetricRegistry.name(Rule.class)) || name.startsWith(MetricRegistry.name(Pipeline.class));
});
counters.entrySet()
.forEach(stringCounterEntry -> result.addResult(new ScalarResult(stringCounterEntry.getKey(),
stringCounterEntry.getValue().getCount(),
"calls",
AggregationPolicy.SUM)));
return results;
}
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:20,代码来源:PipelinePerformanceBenchmarks.java
示例2: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams,
IterationParams iterationParams, IterationResult result) {
final Runtime runtime = Runtime.getRuntime();
final long max = runtime.maxMemory();
final long total = runtime.totalMemory();
final long free = runtime.freeMemory();
final long used = total - free;
return Arrays
.asList(new ProfilerResult(PREFIX + "rt.mem.max", max, "bytes", AggregationPolicy.MAX),
new ProfilerResult(PREFIX + "rt.mem.total", total, "bytes", AggregationPolicy.MAX),
new ProfilerResult(PREFIX + "rt.mem.free", free, "bytes", AggregationPolicy.MAX),
new ProfilerResult(PREFIX + "rt.mem.used", used, "bytes", AggregationPolicy.MAX));
}
开发者ID:bramp,项目名称:unsafe,代码行数:17,代码来源:MemoryProfiler.java
示例3: testBig
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Benchmark
public void testBig(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("W");
break;
case MEASUREMENT:
testSequence.add("I");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:18,代码来源:WarmupMode3_Test.java
示例4: testSmall
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Benchmark
public void testSmall(IterationParams params) {
if (!recorded) {
recorded = true;
switch (params.getType()) {
case WARMUP:
testSequence.add("w");
break;
case MEASUREMENT:
testSequence.add("i");
break;
default:
throw new IllegalStateException(params.getType().toString());
}
}
Fixtures.work();
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:18,代码来源:WarmupMode3_Test.java
示例5: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
Map<String, Long> current = counters().getCurrent();
return Arrays.asList(
new ProfilerResult("@threads.alive",
current.get("java.threads.live"),
"threads", AggregationPolicy.AVG),
new ProfilerResult("@threads.daemon",
current.get("java.threads.daemon"),
"threads", AggregationPolicy.AVG),
new ProfilerResult("@threads.started",
current.get("java.threads.started"),
"threads", AggregationPolicy.MAX)
);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:18,代码来源:HotspotThreadProfiler.java
示例6: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
long gcTime = 0;
long gcCount = 0;
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
gcCount += bean.getCollectionCount();
gcTime += bean.getCollectionTime();
}
return Arrays.asList(
new ProfilerResult("@gc.count.profiled", gcCount - beforeGCCount, "counts", AggregationPolicy.SUM),
new ProfilerResult("@gc.count.total", gcCount, "counts", AggregationPolicy.MAX),
new ProfilerResult("@gc.time.profiled", gcTime - beforeGCTime, "ms", AggregationPolicy.SUM),
new ProfilerResult("@gc.time.total", gcTime, "ms", AggregationPolicy.MAX)
);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:GCProfiler.java
示例7: generateImport
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
private void generateImport(PrintWriter writer) {
Class<?>[] imports = new Class<?>[]{
List.class, AtomicInteger.class,
Collection.class, ArrayList.class,
TimeUnit.class, Generated.class, CompilerControl.class,
InfraControl.class, ThreadParams.class,
Result.class, ThroughputResult.class, AverageTimeResult.class,
SampleTimeResult.class, SingleShotResult.class, SampleBuffer.class,
Mode.class, Fork.class, Measurement.class, Threads.class, Warmup.class,
BenchmarkMode.class, RawResults.class, ResultRole.class,
Field.class, BenchmarkParams.class, IterationParams.class
};
for (Class<?> c : imports) {
writer.println("import " + c.getName() + ';');
}
writer.println();
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:19,代码来源:BenchmarkGenerator.java
示例8: estimateTimeSingleFork
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
private long estimateTimeSingleFork(BenchmarkParams params) {
IterationParams wp = params.getWarmup();
IterationParams mp = params.getMeasurement();
long estimatedTime;
if (params.getMode() == Mode.SingleShotTime) {
// No way to tell how long it will execute,
// guess anything, and let ETA compensation to catch up.
estimatedTime = (wp.getCount() + mp.getCount()) * TimeUnit.MILLISECONDS.toNanos(1);
} else {
estimatedTime =
(wp.getCount() * wp.getTime().convertTo(TimeUnit.NANOSECONDS) +
mp.getCount() * mp.getTime().convertTo(TimeUnit.NANOSECONDS));
}
return estimatedTime;
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:BaseRunner.java
示例9: InfraControlL2
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
public InfraControlL2(BenchmarkParams benchmarkParams, IterationParams iterationParams, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration) {
warmupVisited = new AtomicInteger();
warmdownVisited = new AtomicInteger();
warmupDone = new CountDownLatch(1);
warmdownDone = new CountDownLatch(1);
shouldSynchIterations = benchmarkParams.shouldSynchIterations();
threads = benchmarkParams.getThreads();
warmupShouldWait = shouldSynchIterations;
warmdownShouldWait = shouldSynchIterations;
this.preSetup = preSetup;
this.preTearDown = preTearDown;
this.lastIteration = lastIteration;
this.benchmarkParams = benchmarkParams;
this.iterationParams = iterationParams;
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:20,代码来源:InfraControl.java
示例10: testEmptyOptsHaveCompileCommandFile
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Test
public void testEmptyOptsHaveCompileCommandFile() {
Runner blade = new Runner(new OptionsBuilder());
BenchmarkParams bp = new BenchmarkParams("Foo", "bar", false, 1, new int[]{1}, 1, 1,
new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
Mode.Throughput, null, TimeUnit.SECONDS, 1,
Utils.getCurrentJvm(), Collections.<String>emptyList(),
TimeValue.days(1));
String[] command = blade.getSeparateExecutionCommand(bp, DUMMY_HOST, DUMMY_PORT, Collections.<String>emptyList(), Collections.<String>emptyList());
// expecting 1 compile command file
List<String> files = CompilerHints.getCompileCommandFiles(Arrays.asList(command));
assertEquals(1, files.size());
// file should exist
final String hintFileName = files.get(0);
File hintsFile = new File(hintFileName);
assertTrue(hintsFile.exists());
// hints should be the default as none were specified
Set<String> hints = CompilerHints.fromFile(hintFileName).get();
assertEquals(hints, defaultHints);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:25,代码来源:RunnerTest.java
示例11: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult result) {
if (usedMemory <= 0) {
recordUsedMemory();
if (usedMemory <= 0) {
return Collections.emptyList();
}
}
List<Result> l = new ArrayList<>();
addLinuxVmStats(l);
l.addAll(Arrays.asList(
new ScalarResult("+forced-gc-mem.used.settled", (double) usedMemorySettled, "bytes", AggregationPolicy.AVG),
new ScalarResult("+forced-gc-mem.used.after", (double) usedMemory, "bytes", AggregationPolicy.AVG),
new ScalarResult("+forced-gc-mem.total", (double) totalMemory, "bytes", AggregationPolicy.AVG),
new ScalarResult("+forced-gc-mem.gcTimeMillis", (double) gcTimeMillis, "ms", AggregationPolicy.AVG),
new ScalarResult("+forced-gc-mem.usedHeap", (double) usedHeapMemory, "bytes", AggregationPolicy.AVG)
));
keepReference = null;
return l;
}
开发者ID:cache2k,项目名称:cache2k-benchmark,代码行数:21,代码来源:ForcedGcMemoryProfiler.java
示例12: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
/**
* Run this code after a benchmark iteration finished
*
* @param benchmarkParams benchmark parameters used for current launch
* @param iterationParams iteration parameters used for current launch
* @param result iteration result
* @return profiler results
*/
@Override
public Collection<? extends Result<ProfilerResult>> afterIteration(
BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult result) {
String unit = "invocations";
AggregationPolicy policy = AggregationPolicy.AVG;
final ProfilerResult hashCodeResult =
new ProfilerResult("hashCode", CountingInteger.getHashcodeCounter(), unit, policy);
final ProfilerResult equalsResult =
new ProfilerResult("equals", CountingInteger.getEqualsCounter(), unit, policy);
return Arrays.asList(hashCodeResult, equalsResult);
}
开发者ID:msteindorfer,项目名称:criterion,代码行数:23,代码来源:CountingIntegerProfiler.java
示例13: beforeIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public void beforeIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
try {
startCompTime = comp.getTotalCompilationTime();
} catch (UnsupportedOperationException e) {
startCompTime = -1;
}
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:CompilerProfiler.java
示例14: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
long compTime = -startCompTime;
CompilationMXBean comp = ManagementFactory.getCompilationMXBean();
try {
compTime += comp.getTotalCompilationTime();
} catch (UnsupportedOperationException e) {
compTime = -1;
}
return Arrays.asList(
new ProfilerResult("@compiler.time.profiled", compTime, "ms", AggregationPolicy.SUM),
new ProfilerResult("@compiler.time.total", comp.getTotalCompilationTime(), "ms", AggregationPolicy.MAX)
);
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:16,代码来源:CompilerProfiler.java
示例15: afterIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public Collection<? extends Result> afterIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
HotspotInternalResult res = counters();
Collection<ProfilerResult> results = new ArrayList<ProfilerResult>();
for (Map.Entry<String, Long> e : res.getDiff().entrySet()) {
results.add(new ProfilerResult("@unknown." + e.getKey(), e.getValue(), "unit?", AggregationPolicy.AVG));
}
return results;
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:AbstractHotspotProfiler.java
示例16: beforeIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public void beforeIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
prevs = new HashMap<String, Long>();
for (Counter counter : getCounters()) {
prevs.put(counter.getName(), convert(counter.getValue()));
}
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:8,代码来源:AbstractHotspotProfiler.java
示例17: beforeIteration
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
@Override
public void beforeIteration(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
long gcTime = 0;
long gcCount = 0;
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
gcCount += bean.getCollectionCount();
gcTime += bean.getCollectionTime();
}
this.beforeGCCount = gcCount;
this.beforeGCTime = gcTime;
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:12,代码来源:GCProfiler.java
示例18: addSuperCall
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
public void addSuperCall(PrintWriter writer, StateObject so, String suffix) throws IOException {
// These classes have copying constructor:
if (so.userType.equals(BenchmarkParams.class.getCanonicalName()) ||
so.userType.equals(IterationParams.class.getCanonicalName()) ||
so.userType.equals(ThreadParams.class.getCanonicalName())) {
writer.println(" public " + so.type + suffix + "(" + so.userType + " other) {");
writer.println(" super(other);");
writer.println(" }");
}
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:11,代码来源:StateObjectHandler.java
示例19: stopProfilers
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
protected void stopProfilers(BenchmarkParams benchmarkParams, IterationParams iterationParams, IterationResult iterationResults) {
// stop profilers
for (InternalProfiler prof : registeredProfilers) {
try {
iterationResults.addResults(prof.afterIteration(benchmarkParams, iterationParams));
} catch (Throwable ex) {
throw new BenchmarkException(ex);
}
}
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:11,代码来源:BaseBenchmarkHandler.java
示例20: startProfilers
import org.openjdk.jmh.infra.IterationParams; //导入依赖的package包/类
protected void startProfilers(BenchmarkParams benchmarkParams, IterationParams iterationParams) {
// start profilers
for (InternalProfiler prof : registeredProfilers) {
try {
prof.beforeIteration(benchmarkParams, iterationParams);
} catch (Throwable ex) {
throw new BenchmarkException(ex);
}
}
}
开发者ID:msteindorfer,项目名称:jmh,代码行数:11,代码来源:BaseBenchmarkHandler.java
注:本文中的org.openjdk.jmh.infra.IterationParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论