proc_stats: send cpu_throttled event when throttled state changes

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-04-26 12:35:40 -04:00
parent 275bcde081
commit 80707d1734
1 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ class ProcStats:
self.last_update_time = time.time()
self.last_proc_time = time.process_time()
self.throttle_check_lock = Lock()
self.total_throttled = 0
self.total_throttled = self.last_throttled = 0
self.update_sequence = 0
self.stat_update_cb.start()
@ -98,10 +98,10 @@ class ProcStats:
cur_throttled = ts['bits']
if cur_throttled & ~self.total_throttled:
self.server.add_log_rollover_item(
'throttled', f"CPU Throttled Flags: {ts['flags']}",
True)
self.need_log = False
'throttled', f"CPU Throttled Flags: {ts['flags']}")
if cur_throttled != self.last_throttled:
self.server.send_event("proc_stats:cpu_throttled", ts)
self.last_throttled = cur_throttled
self.total_throttled |= cur_throttled
async def _check_throttled_state(self):