diff options
author | Andreas Fankhauser hiddenalpha.ch | 2022-12-01 12:17:42 +0100 |
---|---|---|
committer | Andreas Fankhauser hiddenalpha.ch | 2022-12-01 12:17:42 +0100 |
commit | d00dea41e1580e5059414f7051698fe5f0ba5fff (patch) | |
tree | cd2a8c763e08e12bcf749c2c944c50b70211534d | |
parent | 26365aed4c321b91cf6ea737cd23eff37341d5f1 (diff) | |
download | UnspecifiedGarbage-d00dea41e1580e5059414f7051698fe5f0ba5fff.zip UnspecifiedGarbage-d00dea41e1580e5059414f7051698fe5f0ba5fff.tar.gz |
(HttpFlood) Improve HttpNullsink stats format
-rw-r--r-- | src/main/nodejs/HttpFlood/HttpNullsink.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/nodejs/HttpFlood/HttpNullsink.js b/src/main/nodejs/HttpFlood/HttpNullsink.js index 97e1653..faad9f4 100644 --- a/src/main/nodejs/HttpFlood/HttpNullsink.js +++ b/src/main/nodejs/HttpFlood/HttpNullsink.js @@ -106,14 +106,16 @@ function logStatsPeriodically( cls_nullsink ){ const durationMs = Math.floor(hrtimeDiffMs(now, cls_nullsink.lastStats)); const totlMs = Math.floor(hrtimeDiffMs(now, cls_nullsink.srvStart)) cls_nullsink.reqTotl += cls_nullsink.reqCnt; - stdlog.write("Stats: Consumed " - + cls_nullsink.reqCnt +" req in " - + durationMs +" ms. So avg " - + Math.floor(cls_nullsink.reqCnt / durationMs * 1000) +" req/sec of overall " - + cls_nullsink.reqTotl +" req in " - + Math.floor(totlMs/1000) +" sec. Avg " - + Math.floor(cls_nullsink.reqTotl / totlMs) + + const reqPerSecStr = (" "+ Math.floor(cls_nullsink.reqCnt / durationMs * 1000)).substr(-6); + const numReqTotalStr = (" "+ cls_nullsink.reqTotl).substr(-9); + const runningSinceSecStr = (" "+ Math.floor(totlMs/1000)).substr(-9); + stdlog.write("Stats: " + + reqPerSecStr +"/sec, " + + numReqTotalStr +" req total, " + + runningSinceSecStr +"s running" +"\n"); + cls_nullsink.lastStats = now; cls_nullsink.reqCnt = 0; scheduleOne(); |