mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-18 07:18:18 +00:00
Implement a minimum interval between cpu_percent() calls. Fixes #1738
This commit is contained in:
@ -19,6 +19,8 @@ import asyncio
|
||||
import json
|
||||
import psutil
|
||||
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
|
||||
|
||||
class NotificationQueue(asyncio.Queue):
|
||||
"""
|
||||
@ -51,7 +53,7 @@ class NotificationQueue(asyncio.Queue):
|
||||
"""
|
||||
msg = {}
|
||||
# Non blocking call in order to get cpu usage. First call will return 0
|
||||
msg["cpu_usage_percent"] = psutil.cpu_percent(interval=None)
|
||||
msg["cpu_usage_percent"] = CpuPercent.get(interval=None)
|
||||
msg["memory_usage_percent"] = psutil.virtual_memory().percent
|
||||
return msg
|
||||
|
||||
|
Reference in New Issue
Block a user