WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: Fix libxenstat statistics for blktap disks on linux

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH]: Fix libxenstat statistics for blktap disks on linux
From: "steven maresca" <steve.maresca@xxxxxxxxx>
Date: Mon, 9 Jun 2008 17:23:49 -0400
Delivery-date: Mon, 09 Jun 2008 14:24:13 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=+nJXGr374F243aGkrMTvoGrl1gZSHS2lWUoqH4zl1bw=; b=NBTxdBl4nw6BXRkCCGqWE+xdpru6eyt3PxLkvRMJwzAPwA4vZzDFQvflgC05Nzkfxh OwtIO42vJyzAM7Wz0gaOc6zoQI66mDf7chLk6Spwg6xbu2h34TooulBJ8owG6TeirCo+ 3vWE4GZfOC9SgYG7h/o2Z4n2MDf2wXyMpQqGw=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=CfVRXZ6+tl7vFSqGm5SsvJHZEPnBc2/nQx056DIc5JNIOwsU/jY4LEfAL/mE6OQYIW +AY6sk8uJEEv7ljBzHYHYFncwd3gZxX+2Ky2QNj+bqTUiHROEY88JAhmSU9MIDwnOR5h BJvk7wdv/TvHRhH6AnvXLAqaMNuX5k88vQiN0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 )


Steve Maresca

Signed-off-by: steve.maresca@xxxxxxxxx

diff -r b320cfe1f10f -r be6917832779 tools/xenstat/libxenstat/src/xenstat_linux.c
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c    Thu Jun 05 13:04:07 2008 +0100
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c    Mon Jun 09 16:34:11 2008 -0400
@@ -181,6 +181,12 @@ int xenstat_collect_vbds(xenstat_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 *
         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
-            continue;
+        } else {
+            continue;
+        }
 
         domain = xenstat_node_domain(node, domid);
         if (domain == NULL) {
@@ -224,24 +234,26 @@ int xenstat_collect_vbds(xenstat_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;

Attachment: xenstat-update
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]: Fix libxenstat statistics for blktap disks on linux, steven maresca <=