Rename statistics counter.
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 13 Nov 2020 15:04:15 +0000 (16:04 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 13 Nov 2020 15:04:15 +0000 (16:04 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/types/CommandStatistics.ts
src/utils/Statistics.ts

index 7a4579b7b47226a00d72fb798566da601ac0318b..8837539517601fd26b25732849a81fff322d831a 100644 (file)
@@ -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;
index ceef29d95d682cbeff4f7562a274a77a378415b3..c2ad25a9938aeb50e60d548a59176f9bfd50a1ab 100644 (file)
@@ -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 {