From 57ee5c2847dcabde8333b7b9facab98aadf86bb7 Mon Sep 17 00:00:00 2001 From: pieterhelsen Date: Mon, 3 May 2021 16:03:16 +0200 Subject: [PATCH 1/2] Add total searches to daily stats Added overall total number of searches. Also added percentage of total searches for 5s/15 measurements --- .../stat_accumulators/search_time_stats.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py b/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py index d3b3ea0..e24125b 100644 --- a/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py +++ b/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py @@ -29,9 +29,17 @@ def consume(self, obj: HarvesterActivityMessage): self._over_15_seconds += 1 def get_summary(self) -> str: + + pct_over_5seconds: float = 0 + pct_over_15seconds: float = 0 + + if self._num_measurements > 0: + pct_over_5seconds = self._over_5_seconds / self._num_measurements * 100 + pct_over_15seconds = self._over_15_seconds / self._num_measurements * 100 + return ( f"Search 🔍: \n" - f"\t - average: {self._avg_time_seconds:0.2f}s average\n" - f"\t - over 5s: {self._over_5_seconds} occasions\n" - f"\t - over 15s: {self._over_15_seconds} occasions" + f"\t - average: {self._avg_time_seconds:0.2f}s average over {self._num_measurements} searches\n" + f"\t - over 5s: {self._over_5_seconds} occasions ({pct_over_5seconds:0.1f}%)\n" + f"\t - over 15s: {self._over_15_seconds} occasions ({pct_over_15seconds:0.1f}%)" ) From 94788e32ae36436bbe3b668d54ced33759cc2259 Mon Sep 17 00:00:00 2001 From: pieterhelsen Date: Sun, 9 May 2021 11:12:14 +0200 Subject: [PATCH 2/2] Remove double 'average' --- .../handlers/daily_stats/stat_accumulators/search_time_stats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py b/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py index e24125b..34fc97d 100644 --- a/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py +++ b/src/chia_log/handlers/daily_stats/stat_accumulators/search_time_stats.py @@ -39,7 +39,7 @@ def get_summary(self) -> str: return ( f"Search 🔍: \n" - f"\t - average: {self._avg_time_seconds:0.2f}s average over {self._num_measurements} searches\n" + f"\t - average: {self._avg_time_seconds:0.2f}s over {self._num_measurements} searches\n" f"\t - over 5s: {self._over_5_seconds} occasions ({pct_over_5seconds:0.1f}%)\n" f"\t - over 15s: {self._over_15_seconds} occasions ({pct_over_15seconds:0.1f}%)" )