fr.jcgay.maven.profiler.KnownElapsedTimeTicker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-profiler Show documentation
Show all versions of maven-profiler Show documentation
Log Maven mojos execution time
package fr.jcgay.maven.profiler;
import com.google.common.base.Stopwatch;
import com.google.common.base.Ticker;
public class KnownElapsedTimeTicker extends Ticker {
private final long expectedElapsedTime;
private boolean firstRead;
public KnownElapsedTimeTicker(long expectedElapsedTime) {
this.expectedElapsedTime = expectedElapsedTime;
}
public static Stopwatch aStopWatchWithElapsedTime(long elapsedTime) {
return new Stopwatch(new KnownElapsedTimeTicker(elapsedTime)).start().stop();
}
@Override
public long read() {
firstRead = !firstRead;
return firstRead ? 0 : expectedElapsedTime;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy