Skip to content

Commit

Permalink
commons: add a way to reset gauges and counters
Browse files Browse the repository at this point in the history
Acked-by: Gerd Behrmann
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Nov 13, 2013
1 parent dc7cb31 commit fb28839
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Expand Up @@ -78,4 +78,9 @@ public interface RequestExecutionTimeGauge {
* @param nextExecTime
*/
void update(long nextExecTime);

/**
* Reset the gauge.
*/
void reset();
}
Expand Up @@ -286,5 +286,16 @@ public synchronized long getPeriodUpdateNum() {
return periodUpdateNum;
}


@Override
public synchronized void reset() {
periodStartTime = System.currentTimeMillis();
periodAverageExecutionTime = 0;
periodUpdateNum = 0;
averageExecutionTime=0;
minExecutionTime=0;
maxExecutionTime=0;
executionTimeRMSS=0;
lastExecutionTime = 0;
updateNum = 0;
}
}
Expand Up @@ -174,4 +174,12 @@ public Set<T> keySet() {
}


/**
* reset all gauges.
*/
public synchronized void reset() {
for (RequestExecutionTimeGauge gauge: gauges.values()) {
gauge.reset();
}
}
}

0 comments on commit fb28839

Please sign in to comment.