Skip to content

Commit

Permalink
refactor limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu committed Mar 25, 2024
1 parent 699f427 commit 69d1998
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docker/activity_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

_KB: Final[int] = 1024

BUSY_USAGE_THRESHOLD_CPU: Final[float] = 5 # percent in range [0, 100]
BUSY_USAGE_THRESHOLD_DISK_READ: Final[int] = 512 * _KB
BUSY_USAGE_THRESHOLD_DISK_WRITE: Final[int] = 512 * _KB
BUSY_USAGE_THRESHOLD_CPU: Final[float] = 0.5 # percent in range [0, 100]
BUSY_USAGE_THRESHOLD_DISK_READ: Final[int] = 0
BUSY_USAGE_THRESHOLD_DISK_WRITE: Final[int] = 0
BUSY_USAGE_THRESHOLD_NETWORK_RECEIVED: Final[int] = 1 * _KB
BUSY_USAGE_THRESHOLD_NETWORK_SENT: Final[int] = 1 * _KB

Expand Down Expand Up @@ -251,8 +251,8 @@ def _get_bytes_over_one_second(
current: tuple[TimeSeconds, BytesRead, BytesWrite],
) -> tuple[BytesRead, BytesWrite]:
interval = current[0] - last[0]
measured_bytes_read_in_interval = current[1]
measured_bytes_write_in_interval = current[2]
measured_bytes_read_in_interval = current[1] - last[1]
measured_bytes_write_in_interval = current[2] - last[2]

# bytes_*_1_second[%] = 1[s] * measured_bytes_*_in_interval[%] / interval[s]
bytes_read_over_1_second = int(measured_bytes_read_in_interval / interval)
Expand Down

0 comments on commit 69d1998

Please sign in to comment.