本文整理匯總了Java中scouter.util.MeteringUtil.Handler類的典型用法代碼示例。如果您正苦於以下問題:Java Handler類的具體用法?Java Handler怎麽用?Java Handler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Handler類屬於scouter.util.MeteringUtil包,在下文中一共展示了Handler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getElapsedAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getElapsedAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.elapsed;
cnt.value += s.requestCount;
}
});
if (isClear) {
sum.value -= lastSlot.elapsed;
cnt.value -= lastSlot.requestCount;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例2: getSqlCountAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getSqlCountAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.sqlCount;
cnt.value += s.requestCount;
}
});
if (isClear) {
sum.value -= lastSlot.sqlCount;
cnt.value -= lastSlot.requestCount;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例3: getSqlTimeAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getSqlTimeAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.sqlTime;
cnt.value += s.requestCount;
}
});
if (isClear) {
sum.value -= lastSlot.sqlTime;
cnt.value -= lastSlot.requestCount;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例4: getRequestCount
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getRequestCount(boolean isClear) {
final INT sum = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.requestCount;
}
});
if (isClear) {
sum.value -= lastSlot.requestCount;
}
return sum.value;
}
示例5: getErrorCount
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getErrorCount(boolean isClear) {
final INT sum = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.errorCount;
}
});
if (isClear) {
sum.value -= lastSlot.errorCount;
}
return sum.value;
}
示例6: getNetTxAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
private int getNetTxAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.netTx;
cnt.value += s.count;
}
});
if (isClear) {
sum.value -= lastSlot.netTx;
cnt.value -= lastSlot.count;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例7: getNetRxAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
private int getNetRxAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.netRx;
cnt.value += s.count;
}
});
if (isClear) {
sum.value -= lastSlot.netRx;
cnt.value -= lastSlot.count;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例8: getDiskReadAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
private int getDiskReadAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.diskRead;
cnt.value += s.count;
}
});
if (isClear) {
sum.value -= lastSlot.diskRead;
cnt.value -= lastSlot.count;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例9: getDiskWriteAvg
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
private int getDiskWriteAvg(boolean isClear) {
final LONG sum = new LONG();
final INT cnt = new INT();
int period = isClear ? 301 : 300;
meter.search(period, new Handler<Slot>() {
public void process(Slot s) {
sum.value += s.diskWrite;
cnt.value += s.count;
}
});
if (isClear) {
sum.value -= lastSlot.diskWrite;
cnt.value -= lastSlot.count;
}
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例10: getElapsed90Pct
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getElapsed90Pct(int period) {
final LONG sum = new LONG();
final INT cnt = new INT();
meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
int total = (int) (b.count * 0.9);
if (total == 0)
return;
for (int timeInx = 0; timeInx < PCT_BUCKET; timeInx++) {
if (total >= b.pct90[timeInx]) {
total -= b.pct90[timeInx];
} else {
sum.value += timeInx * PCT_UNIT_TIME;
cnt.value++;
return;
}
}
sum.value += PCT_MAX_TIME;
cnt.value++;
}
});
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例11: getTPS
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public float getTPS(int period) {
final INT sum = new INT();
period = meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
sum.value += b.count;
}
});
return (float) ((double) sum.value / period);
}
示例12: getElapsedTime
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getElapsedTime(int period) {
final LONG sum = new LONG();
final INT cnt = new INT();
meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
sum.value += b.elapsedTime;
cnt.value += b.count;
}
});
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例13: getSqlTime
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getSqlTime(int period) {
final LONG sum = new LONG();
final INT cnt = new INT();
meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
sum.value += b.sqlTimeByService;
cnt.value += b.count;
}
});
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例14: getApiTime
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getApiTime(int period) {
final LONG sum = new LONG();
final INT cnt = new INT();
meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
sum.value += b.apiTmeByService;
cnt.value += b.count;
}
});
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}
示例15: getQueuingTime
import scouter.util.MeteringUtil.Handler; //導入依賴的package包/類
public int getQueuingTime(int period) {
final LONG sum = new LONG();
final INT cnt = new INT();
meter.search(period, new Handler<MeterService.Bucket>() {
public void process(Bucket b) {
sum.value += b.queuingTime;
cnt.value += b.count;
}
});
return (int) ((cnt.value == 0) ? 0 : sum.value / cnt.value);
}