-
Notifications
You must be signed in to change notification settings - Fork 1
Core Operation
The core functionality can be found in the BenchmarkEngine class. The main workflow is represented well on the sequence diagram below:
Basically, two objects are necessary to start the engine process:
- At first, a Scenario implementation, which contains a hierarchy of phases. That structure includes composite and atomic phases and actually represents a tree hierarchy where all of the leafs are atomic phases. The structure is created in the
build()
method. - Secondly, a DataToken object which defines a communication unit amongst phases, as makes possible to share their information to each other. In practice this means, every phase can operate on the previous one's data.
Every Scenario has to provide a CaseDescriptor object which takes an important part of the serialization of benchmark results and in the area of reporting too. A CaseDescriptor behave as a simple data transfer object which consist of the most necessary parameters. The code can be seen below:
public class CaseDescriptor {
@JsonProperty("CaseName")
protected String caseName;
@JsonProperty("RunIndex")
protected int runIndex;
@JsonProperty("Scenario")
protected String scenario;
@JsonProperty("Tool")
protected String tool;
@JsonProperty("Size")
protected int size;
}
These parameters will be displayed in the output JSON files and will be used in the automatic visualization too. It is highly recommended to instantiate every parameter.
After the initial steps, the engine always asks an AtomicPhase from the Scenario object on which it can operate. The execute
method contains the main functionality of phases. Note that a PhaseResult instance is also given to the previously mentioned method, besides the DataToken. A PhaseResult object represents a container which consists of the results of measurements. Every used metric has to be attached to the PhaseResult in order to be able to gain the information later about measurements, during the publishing process. A typical usage of execute
method in AtomicPhase looks like this:
The last step is to publish every measured metrics.