direct-io.hg

changeset 13590:e4d415692ba5

[XEND] Cleanup old domains in statistics monitor.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Wed Jan 24 15:50:58 2007 +0000 (2007-01-24)
parents f000f963bbfd
children f9eceb9c52d7
files tools/python/xen/xend/XendMonitor.py
line diff
     1.1 --- a/tools/python/xen/xend/XendMonitor.py	Wed Jan 24 15:50:02 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendMonitor.py	Wed Jan 24 15:50:58 2007 +0000
     1.3 @@ -220,10 +220,11 @@ class XendMonitor(threading.Thread):
     1.4          while True:
     1.5              self.lock.acquire()
     1.6              try:
     1.7 -            
     1.8 +                active_domids = set()
     1.9                  # Calculate utilisation for VCPUs
    1.10                  
    1.11                  for domid, cputimes in self._get_cpu_stats().items():
    1.12 +                    active_domids.add(domid)
    1.13                      if domid not in self._domain_vcpus:
    1.14                          # if not initialised, save current stats
    1.15                          # and skip utilisation calculation
    1.16 @@ -310,6 +311,19 @@ class XendMonitor(threading.Thread):
    1.17                      self.pifs_util[pifid] = (rx_util, tx_util)
    1.18                      self.pifs[pifid] = stats
    1.19  
    1.20 +                for domid in self.domain_vcpus_util.keys():
    1.21 +                    if domid not in active_domids:
    1.22 +                        del self.domain_vcpus_util[domid]
    1.23 +                        del self.domain_vcpus[domid]
    1.24 +                for domid in self.domain_vifs_util.keys():
    1.25 +                    if domid not in active_domids:
    1.26 +                        del self.domain_vifs_util[domid]
    1.27 +                        del self.domain_vifs[domid]
    1.28 +                for domid in self.domain_vbds_util.keys():
    1.29 +                    if domid not in active_domids:
    1.30 +                        del self.domain_vbds_util[domid]
    1.31 +                        del self.domain_vbds[domid]
    1.32 +
    1.33              finally:
    1.34                  self.lock.release()
    1.35