From acf1cf2bf4497745b85ee94fe5f54b7e84367e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Majdand=C5=BEi=C4=87?= Date: Thu, 30 Nov 2023 13:22:57 +0100 Subject: [PATCH] Implement control over default max rate for bars --- cliOptions.js | 16 ++++++++++++++-- metrics/metrics.js | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cliOptions.js b/cliOptions.js index 119124f..7487887 100644 --- a/cliOptions.js +++ b/cliOptions.js @@ -60,7 +60,13 @@ const clientOptions = [ name: "metricsinterval", type: Number, defaultOption: 5, - description: "Sets the interval for measuring metrics. A value of 5 considers the packets within the last 5 seconds. Defaults to 5." + description: "Interval for measuring metrics. A value of 5 considers the packets within the last 5 seconds. Defaults to 5." + }, + { + name: "defaultmaxrate", + type: Number, + defaultOption: 1000, + description: "Default max rate for metrics/bars." }, ]; @@ -137,7 +143,13 @@ const centerOptions = [ name: "metricsinterval", type: Number, defaultOption: 5, - description: "Sets the interval for measuring metrics. A value of 5 considers the packets within the last 5 seconds. Defaults to 5." + description: "Interval for measuring metrics. A value of 5 considers the packets within the last 5 seconds. Defaults to 5." + }, + { + name: "defaultmaxrate", + type: Number, + defaultOption: 1000, + description: "Default max rate for metrics/bars." }, ]; diff --git a/metrics/metrics.js b/metrics/metrics.js index 0fb6f39..7a13954 100644 --- a/metrics/metrics.js +++ b/metrics/metrics.js @@ -6,7 +6,7 @@ class Metric { this.multibar = multibar; this.bar = multibar.create(0, 0); this.bar.update(0, { name: barName }); - this.maxRate = 1000; + this.maxRate = this.options.defaultmaxrate; this.bar.total = this.maxRate; this.buffer = new CircularBuffer(bufferSize); if (refresh) {