Package jenkins.benchmark.jmh
Class JmhBenchmarkState
- java.lang.Object
-
- jenkins.benchmark.jmh.JmhBenchmarkState
-
- All Implemented Interfaces:
hudson.ExtensionPoint
,hudson.model.Action
,hudson.model.ModelObject
,hudson.model.RootAction
public abstract class JmhBenchmarkState extends Object implements hudson.model.RootAction
Standard benchmarkState
for JMH when a Jenkins instance is required.To use a Jenkins instance in your benchmark, your class containing benchmarks should have a public static inner class that extends this class and should be annotated with
JmhBenchmark
to allow it to be automatically discovered byBenchmarkFinder
. To configure the instance, usesetup()
.- Since:
- 2.50
- See Also:
setup()
,tearDown()
,BenchmarkFinder
-
-
Constructor Summary
Constructors Constructor Description JmhBenchmarkState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDisplayName()
String
getIconFileName()
jenkins.model.Jenkins
getJenkins()
Get reference to theJenkins
started for the benchmark.String
getUrlName()
void
setup()
Override to setup resources required for the benchmark.void
setupJenkins()
Sets up the temporary Jenkins instance for benchmarks.void
tearDown()
Override to perform cleanup of resource initialized during setup.void
terminateJenkins()
Terminates the jenkins instance after the benchmark has completed its execution.
-
-
-
Method Detail
-
setupJenkins
public final void setupJenkins() throws Exception
Sets up the temporary Jenkins instance for benchmarks.One Jenkins instance is created for each fork of the benchmark.
- Throws:
Exception
- if unable to start the instance.
-
terminateJenkins
public final void terminateJenkins()
Terminates the jenkins instance after the benchmark has completed its execution. Run once for each Jenkins that was started.
-
getJenkins
public jenkins.model.Jenkins getJenkins()
Get reference to theJenkins
started for the benchmark.The instance can also be obtained using
Jenkins.getInstanceOrNull()
- Returns:
- the Jenkins instance started for the benchmark.
-
setup
public void setup() throws Exception
Override to setup resources required for the benchmark.Runs before the benchmarks are run. At this state, the Jenkins instance is ready to be worked upon and is available using
getJenkins()
. Does nothing by default.- Throws:
Exception
-
tearDown
public void tearDown()
Override to perform cleanup of resource initialized during setup.Run before the Jenkins instance is terminated. Does nothing by default.
-
getIconFileName
@CheckForNull public String getIconFileName()
- Specified by:
getIconFileName
in interfacehudson.model.Action
-
getDisplayName
@CheckForNull public String getDisplayName()
- Specified by:
getDisplayName
in interfacehudson.model.Action
- Specified by:
getDisplayName
in interfacehudson.model.ModelObject
-
getUrlName
@CheckForNull public String getUrlName()
- Specified by:
getUrlName
in interfacehudson.model.Action
-
-