From 44dc35e97277c7b6f2c21b5e1806605f620b5242 Mon Sep 17 00:00:00 2001 From: Pawel Marczewski Date: Wed, 15 Jan 2020 16:37:57 +0100 Subject: [PATCH] Implement missing get_cputime() in AdminVM --- qubes/vm/adminvm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qubes/vm/adminvm.py b/qubes/vm/adminvm.py index 46871b7b..a1b32ee5 100644 --- a/qubes/vm/adminvm.py +++ b/qubes/vm/adminvm.py @@ -160,6 +160,18 @@ class AdminVM(qubes.vm.BaseVM): self.log.warning('Failed to get memory limit for dom0: %s', e) return 4096 + def get_cputime(self): + '''Get total CPU time burned by Dom0 since start. + + .. seealso: + :py:meth:`qubes.vm.qubesvm.QubesVM.get_cputime` + ''' + try: + return self.libvirt_domain.info()[4] + except libvirt.libvirtError as e: + self.log.warning('Failed to get CPU time for dom0: %s', e) + return 0 + def verify_files(self): '''Always :py:obj:`True`