Moved monitoring of last_execution_time to system_stats (#9851)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Tim O'Farrell
2025-07-22 11:32:59 -06:00
committed by GitHub
parent 38ffc85470
commit e045b757fa
5 changed files with 132 additions and 26 deletions

View File

@@ -4,6 +4,25 @@ import time
import psutil
_start_time = time.time()
_last_execution_time = time.time()
def get_system_info() -> dict[str, object]:
current_time = time.time()
uptime = current_time - _start_time
idle_time = current_time - _last_execution_time
return {
'uptime': uptime,
'idle_time': idle_time,
'resources': get_system_stats(),
}
def update_last_execution_time():
global _last_execution_time
_last_execution_time = time.time()
def get_system_stats() -> dict[str, object]:
"""Get current system resource statistics.