Skip to content

Commit

Permalink
Get avg cpu too
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Mar 29, 2024
1 parent b588477 commit 270cabf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jarvis_util/introspect/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ def peak_memory(self):
for mem in self.mem[hostname]:
peak = max(peak, mem['percent'])
return peak

def avg_cpu(self):
total = 0
count = 0
for hostname in self.cpu:
for cpu in self.cpu[hostname]:
total += cpu['percent']
count += 1
return total / count

0 comments on commit 270cabf

Please sign in to comment.