Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jglauber/fixes #23

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions vmtop.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def read_int(filename):

def mixrange(s):
r = []
if not s:
return r
if s == '\n':
return r

for i in s.split(","):
if "-" not in i:
r.append(int(i))
Expand Down Expand Up @@ -304,6 +309,8 @@ def nr_vcpus(self):
return len(self.vcpu_threads.keys())

def set_vcpu_primary_node(self, new_node):
if new_node is None:
return
if self.vcpu_primary_node == new_node:
return
if self.vcpu_primary_node is not None:
Expand Down Expand Up @@ -530,6 +537,11 @@ def refresh_io_stats(self):
self.last_io_write_bytes = int(l[1])

def get_node_memory(self):
path = shutil.which("numastat")
if path is None:
print("no executable found for numastat")
return

cmd = ["numastat", "-p", str(self.vm_pid)]
try:
usage = subprocess.check_output(
Expand Down