![JAR search and dependency download from the Maven repository](/logo.png)
com.fillumina.performance.producer.suite.ParametrizedRunnableSink Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of performance-tools Show documentation
Show all versions of performance-tools Show documentation
Configurable tool to easily compare performances of different code
snippets and to take performance telemetry of a running application.
The newest version!
package com.fillumina.performance.producer.suite;
/**
* It's a {@link ParametrizedRunnable} that avoids dead code eviction.
*
* @author Francesco Illuminati
*/
public abstract class ParametrizedRunnableSink
extends ParametrizedRunnable
{
private static final Object REFERENCE = new Object();
/**
* Override this method to provide the test's code.
* The returned value is managed so the code used to get it is not
* removed by the optimizations of the JVM.
*/
public abstract Object sink(final P param);
@Override
public void call(final P param) {
final Object obj = sink(param);
// force obj to be evaluated and so the code returning it
// will not be evicted
if (obj == REFERENCE) {
throw new AssertionError();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy