From 4a71152b4affee2459a0787b520dd2f6560ed203 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 13 Nov 2020 16:04:15 +0100 Subject: [PATCH] Rename statistics counter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/types/CommandStatistics.ts | 3 ++- src/utils/Statistics.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/types/CommandStatistics.ts b/src/types/CommandStatistics.ts index 7a4579b7..88375395 100644 --- a/src/types/CommandStatistics.ts +++ b/src/types/CommandStatistics.ts @@ -2,7 +2,8 @@ export interface CommandStatisticsData { countRequest: number; countResponse: number; countError: number; - countTime: number; + countTimeMeasurement: number; + currentTime: number; minTime: number; maxTime: number; totalTime: number; diff --git a/src/utils/Statistics.ts b/src/utils/Statistics.ts index ceef29d9..c2ad25a9 100644 --- a/src/utils/Statistics.ts +++ b/src/utils/Statistics.ts @@ -103,11 +103,12 @@ export default class Statistics { this._commandsStatistics[command] = {} as CommandStatisticsData; } // Update current statistics timers - this._commandsStatistics[command].countTime = this._commandsStatistics[command].countTime ? this._commandsStatistics[command].countTime + 1 : 1; + this._commandsStatistics[command].countTimeMeasurement = this._commandsStatistics[command].countTimeMeasurement ? this._commandsStatistics[command].countTimeMeasurement + 1 : 1; + this._commandsStatistics[command].currentTime = duration; this._commandsStatistics[command].minTime = this._commandsStatistics[command].minTime ? (this._commandsStatistics[command].minTime > duration ? duration : this._commandsStatistics[command].minTime) : duration; this._commandsStatistics[command].maxTime = this._commandsStatistics[command].maxTime ? (this._commandsStatistics[command].maxTime < duration ? duration : this._commandsStatistics[command].maxTime) : duration; this._commandsStatistics[command].totalTime = this._commandsStatistics[command].totalTime ? this._commandsStatistics[command].totalTime + duration : duration; - this._commandsStatistics[command].avgTime = this._commandsStatistics[command].totalTime / this._commandsStatistics[command].countTime; + this._commandsStatistics[command].avgTime = this._commandsStatistics[command].totalTime / this._commandsStatistics[command].countTimeMeasurement; } private _logPrefix(): string { -- 2.34.1