Package org.teavm.perf
Class CBackend
java.lang.Object
org.teavm.perf.BenchmarkBackend
org.teavm.perf.CBackend
Compiles benchmarks to C, then compiles C code to an executable and runs it. Every fork runs in a separate
process.
-
Field Summary
Fields inherited from class org.teavm.perf.BenchmarkBackend
environment -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompile(BenchmarkInfo benchmark, File directory) Human-readable description, used in reports.getName()Short identifier of the backend, also used in command line.voidrun(CompiledBenchmark benchmark, String argument, Consumer<String> outputConsumer) Runs compiled benchmark once, i.e. performs a single JMH fork.voidsetBuildScript(File buildScript) Sets script that is used to compile C code instead of invoking C compiler directly.voidsetCompiler(String compiler) voidsetCompilerFlags(List<String> compilerFlags) voidsetEnvScript(File envScript) Sets script that prepares environment for C compiler (for example, sets up MSVC developer environment).Methods inherited from class org.teavm.perf.BenchmarkBackend
build, copyResource, start, stop, supportsCpuProfiling, takeCpuProfile
-
Constructor Details
-
CBackend
-
-
Method Details
-
setCompiler
-
setCompilerFlags
-
setBuildScript
Sets script that is used to compile C code instead of invoking C compiler directly. The script runs in the directory with generated C code and must producebenchmarkexecutable (benchmark.exeon Windows) in the same directory. -
setEnvScript
Sets script that prepares environment for C compiler (for example, sets up MSVC developer environment). The script runs once, then the environment it produces is used for every compiler invocation. -
getName
Description copied from class:BenchmarkBackendShort identifier of the backend, also used in command line.- Specified by:
getNamein classBenchmarkBackend
-
getDescription
Description copied from class:BenchmarkBackendHuman-readable description, used in reports. Mapped tovmNamefield of JMH JSON output.- Specified by:
getDescriptionin classBenchmarkBackend
-
compile
- Specified by:
compilein classBenchmarkBackend- Throws:
BenchmarkException
-
run
public void run(CompiledBenchmark benchmark, String argument, Consumer<String> outputConsumer) throws BenchmarkException Description copied from class:BenchmarkBackendRuns compiled benchmark once, i.e. performs a single JMH fork.- Specified by:
runin classBenchmarkBackend- Parameters:
outputConsumer- receives every line written by benchmark to stdout.- Throws:
BenchmarkException
-