diff --git a/kiwi_simple_metrics/metrics/cpu.py b/kiwi_simple_metrics/metrics/cpu.py index 6649ba1..e3e0dfe 100644 --- a/kiwi_simple_metrics/metrics/cpu.py +++ b/kiwi_simple_metrics/metrics/cpu.py @@ -9,7 +9,7 @@ from ._report import Report, ReportData def _hwdata() -> Iterator[ReportData]: yield ReportData.from_settings( name=SETTINGS.cpu.name, - value=psutil.cpu_percent(interval=1), + value=psutil.cpu_percent(interval=SETTINGS.cpu.interval), settings=SETTINGS.cpu, ) diff --git a/kiwi_simple_metrics/settings/metric.py b/kiwi_simple_metrics/settings/metric.py index a853d72..49e1b23 100644 --- a/kiwi_simple_metrics/settings/metric.py +++ b/kiwi_simple_metrics/settings/metric.py @@ -54,6 +54,9 @@ class CpuMS(MetricSettings): name: str = "CPU" threshold: float = math.inf + # timespan to analyze average CPU usage + interval: float = 1 + class MemoryMS(MetricSettings): name: str = "Memory"