aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstat
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-06-10 09:27:01 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-06-10 09:27:01 +0100
commit572d6c9581d7f82e387558edc94a2c3df9631186 (patch)
tree15863615995ff3098ac3b5eab1649e7e965778aa /tools/xenstat
parentbb4e3f0ec086b5add7709533a2be0ac1d4aaec19 (diff)
downloadxen-572d6c9581d7f82e387558edc94a2c3df9631186.tar.gz
xen-572d6c9581d7f82e387558edc94a2c3df9631186.tar.bz2
xen-572d6c9581d7f82e387558edc94a2c3df9631186.zip
libxenstat: Fix statistics for blktap disks on linux
Overview: update xenstat vbd statistics parsing from /sys/devices/xen-backend to process blktap disks Reason: -blktap devices (now referenced as tap rather than vbd in /sys) have statistics counters (e.g., rd_req, wr_req, oo_req) prepended by tap_ -xenstat behavior did not previously account for this behavior, which resulted in 0 disks visible and similarly impacted disk statistics To reproduce these conditions, make a domain with tap:aio backed disks on 3.2.x, run xentop, and press B to view VBD stats (nothing will appear for the domain using tap:aio) Signed-off-by: steve.maresca@gmail.com
Diffstat (limited to 'tools/xenstat')
-rw-r--r--tools/xenstat/libxenstat/src/xenstat_linux.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index d6e2cf3fe0..46f8bb76df 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -181,6 +181,12 @@ int xenstat_collect_vbds(xenstat_node * node)
struct dirent *dp;
struct priv_data *priv = get_priv_data(node->handle);
+ char *sys_prefix = "statistics/";
+
+ /* 23 = "statistics/" + "xxxx_xx_req" */
+ char ooreq[23], rdreq[23], wrreq[23];
+ char *stat_prefix = NULL;
+
if (priv == NULL) {
perror("Allocation error");
return 0;
@@ -208,12 +214,16 @@ int xenstat_collect_vbds(xenstat_node * node)
if (ret != 3)
continue;
- if (strcmp(buf,"vbd") == 0)
+
+ if (strcmp(buf,"vbd") == 0){
+ stat_prefix = "";
vbd.back_type = 1;
- else if (strcmp(buf,"tap") == 0)
+ } else if (strcmp(buf,"tap") == 0){
+ stat_prefix = "tap_";
vbd.back_type = 2;
- else
+ } else {
continue;
+ }
domain = xenstat_node_domain(node, domid);
if (domain == NULL) {
@@ -224,25 +234,27 @@ int xenstat_collect_vbds(xenstat_node * node)
continue;
}
- if((read_attributes_vbd(dp->d_name, "statistics/oo_req", buf, 256)<=0)
+ snprintf(ooreq, sizeof(ooreq), "%s%soo_req", sys_prefix, stat_prefix);
+ if((read_attributes_vbd(dp->d_name, ooreq, buf, 256)<=0)
|| ((ret = sscanf(buf, "%llu", &vbd.oo_reqs)) != 1))
{
continue;
}
- if((read_attributes_vbd(dp->d_name, "statistics/rd_req", buf, 256)<=0)
+ snprintf(rdreq, sizeof(rdreq),"%s%srd_req", sys_prefix, stat_prefix);
+ if((read_attributes_vbd(dp->d_name, rdreq, buf, 256)<=0)
|| ((ret = sscanf(buf, "%llu", &vbd.rd_reqs)) != 1))
{
continue;
}
- if((read_attributes_vbd(dp->d_name, "statistics/wr_req", buf, 256)<=0)
+ snprintf(wrreq, sizeof(wrreq),"%s%swr_req", sys_prefix, stat_prefix);
+ if((read_attributes_vbd(dp->d_name, wrreq, buf, 256)<=0)
|| ((ret = sscanf(buf, "%llu", &vbd.wr_reqs)) != 1))
{
continue;
}
-
if (domain->vbds == NULL) {
domain->num_vbds = 1;
domain->vbds = malloc(sizeof(xenstat_vbd));