Skip to content

Commit

Permalink
Changed withHistogram to useHistogram
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinmay Soman committed Mar 15, 2012
1 parent 7266799 commit ea2c4f0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/java/voldemort/store/stats/RequestCounter.java
Expand Up @@ -19,7 +19,7 @@ public class RequestCounter {
private final Histogram histogram;
private volatile int q95LatencyMs;
private volatile int q99LatencyMs;
private boolean withHistogram;
private boolean useHistogram;

/**
* @param durationMS specifies for how long you want to maintain this
Expand All @@ -31,11 +31,11 @@ public RequestCounter(int durationMS) {

/**
* @param durationMS specifies for how long you want to maintain this
* counter (in milliseconds). withHistogram indicates that this
* counter (in milliseconds). useHistogram indicates that this
* counter should also use a histogram.
*/
public RequestCounter(int durationMS, boolean withHistogram) {
this(durationMS, SystemTime.INSTANCE, withHistogram);
public RequestCounter(int durationMS, boolean useHistogram) {
this(durationMS, SystemTime.INSTANCE, useHistogram);
}

/**
Expand All @@ -45,14 +45,14 @@ public RequestCounter(int durationMS, boolean withHistogram) {
this(durationMS, time, false);
}

RequestCounter(int durationMS, Time time, boolean withHistogram) {
RequestCounter(int durationMS, Time time, boolean useHistogram) {
this.time = time;
this.values = new AtomicReference<Accumulator>(new Accumulator());
this.durationMS = durationMS;
this.q95LatencyMs = 0;
this.q99LatencyMs = 0;
this.withHistogram = withHistogram;
if(this.withHistogram)
this.useHistogram = useHistogram;
if(this.useHistogram)
this.histogram = new Histogram(10000, 1);
else
this.histogram = null;
Expand Down Expand Up @@ -107,7 +107,7 @@ public long getMaxLatencyInMs() {
}

private void maybeResetHistogram() {
if(!this.withHistogram)
if(!this.useHistogram)
return;
Accumulator accum = values.get();
long now = time.getMilliseconds();
Expand Down Expand Up @@ -172,7 +172,7 @@ public void addRequest(long timeNS,
long bytes,
long getAllAggregatedCount) {
int timeMs = (int) timeNS / (int) Time.NS_PER_MS;
if(this.withHistogram) {
if(this.useHistogram) {
histogram.insert(timeMs);
maybeResetHistogram();
}
Expand Down

0 comments on commit ea2c4f0

Please sign in to comment.