Skip to content

Commit 3ae3b0a

Browse files
author
wujiuye
committed
可获取一分钟的统计
1 parent 5596731 commit 3ae3b0a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/main/java/github/wujiuye/qps/LeapArray.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ public T getWindowValue(long timeMillis) {
170170
}
171171

172172

173+
/**
174+
* return time > start + intervalInMs(1分钟)
175+
*
176+
* @param time
177+
* @param windowWrap
178+
* @return
179+
*/
173180
public boolean isWindowDeprecated(long time, WindowWrap<T> windowWrap) {
174181
return time - windowWrap.windowStart() > intervalInMs;
175182
}

src/main/java/github/wujiuye/qps/QpsHelper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,13 @@ public double successQps() {
145145
return rollingCounterInSecond.success() / rollingCounterInSecond.getWindowIntervalInSec();
146146
}
147147

148+
/**
149+
* 获取1分钟的统计
150+
*
151+
* @return
152+
*/
153+
public MetricBucket[] bucketsInMinute() {
154+
return rollingCounterInMinute.buckets();
155+
}
156+
148157
}

0 commit comments

Comments
 (0)