Skip to content
Snippets Groups Projects
Commit d42df683 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Add implementation of verification metrics for execution time

parent fa3aeaf7
Branches
Tags
No related merge requests found
package de.unikoblenz.fgbks.core.dmn.verification.metrics;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.VerificationType;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang3.Validate;
/**
* A metric set contains all metrics.
*/
public class MetricSet implements Serializable {
private Set<Metric> metrics = new HashSet<>();
/**
* Get all metrics.
*
* @return the set of {@link Metric}s
*/
@JsonProperty("verificationMetrics")
public Set<Metric> getMetrics() {
return new HashSet<>(metrics);
}
/**
* Add a new execution time of a verifier to the metric map
*
* @param type the {@link VerificationType}
* @param timeInNs the time in ns
*/
public synchronized void addExecutionTime(VerificationType type, long timeInNs) {
Validate.notNull(type);
Metric m =
metrics.stream().filter(x -> x.type.equals(type)).findFirst().orElse(new Metric(type));
m.addExecutionTime(timeInNs);
metrics.add(m);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment