debuggers.hg
changeset 14635:104fc282e53c
Use the new blkback sysfs statistics/{rd,wr}_sect to get a more accurate
bandwidth measurements for VBD I/O.
Patch by Alastair Tse <atse@xensource.com>.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
bandwidth measurements for VBD I/O.
Patch by Alastair Tse <atse@xensource.com>.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Tue Mar 27 16:33:26 2007 +0100 (2007-03-27) |
parents | 6664a713f55f |
children | ea68ae90fc10 |
files | tools/python/xen/xend/XendMonitor.py |
line diff
1.1 --- a/tools/python/xen/xend/XendMonitor.py Tue Mar 27 19:05:48 2007 +0100 1.2 +++ b/tools/python/xen/xend/XendMonitor.py Tue Mar 27 16:33:26 2007 +0100 1.3 @@ -24,8 +24,8 @@ import re 1.4 """Monitoring thread to keep track of Xend statistics. """ 1.5 1.6 VBD_SYSFS_PATH = '/sys/devices/xen-backend/' 1.7 -VBD_WR_PATH = VBD_SYSFS_PATH + '%s/statistics/wr_req' 1.8 -VBD_RD_PATH = VBD_SYSFS_PATH + '%s/statistics/rd_req' 1.9 +VBD_WR_PATH = VBD_SYSFS_PATH + '%s/statistics/wr_sect' 1.10 +VBD_RD_PATH = VBD_SYSFS_PATH + '%s/statistics/rd_sect' 1.11 VBD_DOMAIN_RE = r'vbd-(?P<domid>\d+)-(?P<devid>\d+)$' 1.12 1.13 NET_PROCFS_PATH = '/proc/net/dev' 1.14 @@ -51,14 +51,9 @@ VIF_DOMAIN_RE = re.compile(r'vif(?P<domi 1.15 PROC_NET_DEV_RE) 1.16 PIF_RE = re.compile(r'^\s*(?P<iface>peth\d+):\s*' + PROC_NET_DEV_RE) 1.17 1.18 -# The VBD transfer figures are in "requests" where we don't 1.19 -# really know how many bytes per requests. For now we make 1.20 -# up a number roughly could be. 1.21 -VBD_ROUGH_BYTES_PER_REQUEST = 1024 * 8 * 4 1.22 - 1.23 # Interval to poll xc, sysfs and proc 1.24 POLL_INTERVAL = 2.0 1.25 - 1.26 +SECTOR_SIZE = 512 1.27 class XendMonitor(threading.Thread): 1.28 """Monitors VCPU, VBD, VIF and PIF statistics for Xen API. 1.29 1.30 @@ -186,9 +181,8 @@ class XendMonitor(threading.Thread): 1.31 usage_at = time.time() 1.32 rd_stat = int(open(rd_stat_path).readline().strip()) 1.33 wr_stat = int(open(wr_stat_path).readline().strip()) 1.34 - rd_stat *= VBD_ROUGH_BYTES_PER_REQUEST 1.35 - wr_stat *= VBD_ROUGH_BYTES_PER_REQUEST 1.36 - 1.37 + rd_stat *= SECTOR_SIZE 1.38 + wr_stat *= SECTOR_SIZE 1.39 if domid not in stats: 1.40 stats[domid] = {} 1.41