com.emc.mongoose.api.metrics.ResumableUserTimeClock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-api-metrics Show documentation
Show all versions of mongoose-api-metrics Show documentation
Mongoose is a high-load storage performance testing tool
package com.emc.mongoose.api.metrics;
import com.codahale.metrics.Clock;
import java.util.concurrent.TimeUnit;
/**
* Created by gusakk on 02.07.15.
*/
public class ResumableUserTimeClock
extends Clock.UserTimeClock {
//
// these parameters are necessary for pause/resume Mongoose w/ SIGSTOP and SIGCONT signals
private long lastTimeBeforeTermination;
private long elapsedTimeInPause;
private static final long TICK_INTERVAL = TimeUnit.SECONDS.toNanos(1);
//
public ResumableUserTimeClock() {
lastTimeBeforeTermination = 0;
elapsedTimeInPause = 0;
}
//
@Override
public long getTick() {
// TODO: implement this functionality #JIRA-451
// This Clock's implementation provides correct time for calculating different metrics
// after resumption Mongoose's run w/ SIGCONT signal.
/*final long currTime = System.nanoTime();
if(lastTimeBeforeTermination > 0) {
if(currTime - lastTimeBeforeTermination > TICK_INTERVAL) {
elapsedTimeInPause += currTime - lastTimeBeforeTermination;
lastTimeBeforeTermination = currTime;
return currTime - elapsedTimeInPause;
}
}
lastTimeBeforeTermination = currTime;
return currTime - elapsedTimeInPause;*/
return super.getTick();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy