![JAR search and dependency download from the Maven repository](/logo.png)
com.fillumina.performance.producer.RunningLoopPerformances 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;
import java.io.Serializable;
import java.util.*;
/**
* Keeps the live statistics.
*
* @author Francesco Illuminati
*/
public class RunningLoopPerformances implements Serializable {
private static final long serialVersionUID = 1L;
private final Map timeMap = new LinkedHashMap<>();
private long iterations;
public RunningLoopPerformances() {
this(0);
}
public RunningLoopPerformances(final long iterations) {
this.iterations = iterations;
}
public void setIterations(final long iterations) {
this.iterations = iterations;
}
public long getIterations() {
return iterations;
}
public void add(final String msg, final long elapsed) {
final Long time = timeMap.get(msg);
final long value;
if (time == null) {
value = elapsed;
} else {
value = time + elapsed;
}
timeMap.put(msg, value);
}
public LoopPerformances getLoopPerformances() {
return new LoopPerformances(iterations, timeMap);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy