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-changelog

[Xen-changelog] [xen-unstable] xentop: Add two more VBD statistics

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xentop: Add two more VBD statistics
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Nov 2009 04:05:12 -0800
Delivery-date: Thu, 05 Nov 2009 04:05:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1257422458 0
# Node ID ac9d4ba48b8334f0adc3a928be4e48d2e6fdebd1
# Parent  23b43708aad602ce5c24222ef4321c6c65078187
xentop: Add two more VBD statistics

In addition to VBD read/write request#, add VBD read/write sector#
also. It makes VBD throughput observation easier. As the method to get
such info is OS dependent, just Linux version code is added.

Signed-off-by: Yang Xiaowei <xiaowei.yang@xxxxxxxxx>
---
 tools/xenstat/libxenstat/src/xenstat.c       |   12 +++
 tools/xenstat/libxenstat/src/xenstat.h       |    2 
 tools/xenstat/libxenstat/src/xenstat_linux.c |   12 +++
 tools/xenstat/libxenstat/src/xenstat_priv.h  |    2 
 tools/xenstat/xentop/xentop.c                |   97 ++++++++++++++++++++-------
 5 files changed, 100 insertions(+), 25 deletions(-)

diff -r 23b43708aad6 -r ac9d4ba48b83 tools/xenstat/libxenstat/src/xenstat.c
--- a/tools/xenstat/libxenstat/src/xenstat.c    Wed Nov 04 22:32:01 2009 +0000
+++ b/tools/xenstat/libxenstat/src/xenstat.c    Thu Nov 05 12:00:58 2009 +0000
@@ -653,6 +653,18 @@ unsigned long long xenstat_vbd_wr_reqs(x
        return vbd->wr_reqs;
 }
 
+/* Get the number of READ sectors */
+unsigned long long xenstat_vbd_rd_sects(xenstat_vbd * vbd)
+{
+       return vbd->rd_sects;
+}
+
+/* Get the number of WRITE sectors */
+unsigned long long xenstat_vbd_wr_sects(xenstat_vbd * vbd)
+{
+       return vbd->wr_sects;
+}
+
 static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int 
domain_id)
 {
        char path[80], *vmpath;
diff -r 23b43708aad6 -r ac9d4ba48b83 tools/xenstat/libxenstat/src/xenstat.h
--- a/tools/xenstat/libxenstat/src/xenstat.h    Wed Nov 04 22:32:01 2009 +0000
+++ b/tools/xenstat/libxenstat/src/xenstat.h    Thu Nov 05 12:00:58 2009 +0000
@@ -183,5 +183,7 @@ unsigned long long xenstat_vbd_oo_reqs(x
 unsigned long long xenstat_vbd_oo_reqs(xenstat_vbd * vbd);
 unsigned long long xenstat_vbd_rd_reqs(xenstat_vbd * vbd);
 unsigned long long xenstat_vbd_wr_reqs(xenstat_vbd * vbd);
+unsigned long long xenstat_vbd_rd_sects(xenstat_vbd * vbd);
+unsigned long long xenstat_vbd_wr_sects(xenstat_vbd * vbd);
 
 #endif /* XENSTAT_H */
diff -r 23b43708aad6 -r ac9d4ba48b83 
tools/xenstat/libxenstat/src/xenstat_linux.c
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c      Wed Nov 04 22:32:01 
2009 +0000
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c      Thu Nov 05 12:00:58 
2009 +0000
@@ -243,6 +243,18 @@ int xenstat_collect_vbds(xenstat_node * 
                        continue;
                }
 
+               if((read_attributes_vbd(dp->d_name, "statistics/rd_sect", buf, 
256)<=0)
+                  || ((ret = sscanf(buf, "%llu", &vbd.rd_sects)) != 1))
+               {
+                       continue;
+               }
+
+               if((read_attributes_vbd(dp->d_name, "statistics/wr_sect", buf, 
256)<=0)
+                  || ((ret = sscanf(buf, "%llu", &vbd.wr_sects)) != 1))
+               {
+                       continue;
+               }
+
                if (domain->vbds == NULL) {
                        domain->num_vbds = 1;
                        domain->vbds = malloc(sizeof(xenstat_vbd));
diff -r 23b43708aad6 -r ac9d4ba48b83 tools/xenstat/libxenstat/src/xenstat_priv.h
--- a/tools/xenstat/libxenstat/src/xenstat_priv.h       Wed Nov 04 22:32:01 
2009 +0000
+++ b/tools/xenstat/libxenstat/src/xenstat_priv.h       Thu Nov 05 12:00:58 
2009 +0000
@@ -92,6 +92,8 @@ struct xenstat_vbd {
        unsigned long long oo_reqs;
        unsigned long long rd_reqs;
        unsigned long long wr_reqs;
+       unsigned long long rd_sects;
+       unsigned long long wr_sects;
 };
 
 extern int xenstat_collect_networks(xenstat_node * node);
diff -r 23b43708aad6 -r ac9d4ba48b83 tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c     Wed Nov 04 22:32:01 2009 +0000
+++ b/tools/xenstat/xentop/xentop.c     Thu Nov 05 12:00:58 2009 +0000
@@ -116,6 +116,10 @@ static void print_vbd_rd(xenstat_domain 
 static void print_vbd_rd(xenstat_domain *domain);
 static int compare_vbd_wr(xenstat_domain *domain1, xenstat_domain *domain2);
 static void print_vbd_wr(xenstat_domain *domain);
+static int compare_vbd_rsect(xenstat_domain *domain1, xenstat_domain *domain2);
+static void print_vbd_rsect(xenstat_domain *domain);
+static int compare_vbd_wsect(xenstat_domain *domain1, xenstat_domain *domain2);
+static void print_vbd_wsect(xenstat_domain *domain);
 
 
 /* Section printing functions */
@@ -147,6 +151,8 @@ typedef enum field_id {
        FIELD_VBD_OO,
        FIELD_VBD_RD,
        FIELD_VBD_WR,
+       FIELD_VBD_RSECT,
+       FIELD_VBD_WSECT,
        FIELD_SSID
 } field_id;
 
@@ -159,23 +165,25 @@ typedef struct field {
 } field;
 
 field fields[] = {
-       { FIELD_NAME,    "NAME",      10, compare_name,    print_name    },
-       { FIELD_STATE,   "STATE",      6, compare_state,   print_state   },
-       { FIELD_CPU,     "CPU(sec)",  10, compare_cpu,     print_cpu     },
-       { FIELD_CPU_PCT, "CPU(%)",     6, compare_cpu_pct, print_cpu_pct },
-       { FIELD_MEM,     "MEM(k)",    10, compare_mem,     print_mem     },
-       { FIELD_MEM_PCT, "MEM(%)",     6, compare_mem,     print_mem_pct },
-       { FIELD_MAXMEM,  "MAXMEM(k)", 10, compare_maxmem,  print_maxmem  },
-       { FIELD_MAX_PCT, "MAXMEM(%)",  9, compare_maxmem,  print_max_pct },
-       { FIELD_VCPUS,   "VCPUS",      5, compare_vcpus,   print_vcpus   },
-       { FIELD_NETS,    "NETS",       4, compare_nets,    print_nets    },
-       { FIELD_NET_TX,  "NETTX(k)",   8, compare_net_tx,  print_net_tx  },
-       { FIELD_NET_RX,  "NETRX(k)",   8, compare_net_rx,  print_net_rx  },
-       { FIELD_VBDS,    "VBDS",       4, compare_vbds,    print_vbds    },
-       { FIELD_VBD_OO,  "VBD_OO",     8, compare_vbd_oo,  print_vbd_oo  },
-       { FIELD_VBD_RD,  "VBD_RD",     8, compare_vbd_rd,  print_vbd_rd  },
-       { FIELD_VBD_WR,  "VBD_WR",     8, compare_vbd_wr,  print_vbd_wr  },
-       { FIELD_SSID,    "SSID",       4, compare_ssid,    print_ssid    }
+       { FIELD_NAME,      "NAME",      10, compare_name,      print_name    },
+       { FIELD_STATE,     "STATE",      6, compare_state,     print_state   },
+       { FIELD_CPU,       "CPU(sec)",  10, compare_cpu,       print_cpu     },
+       { FIELD_CPU_PCT,   "CPU(%)",     6, compare_cpu_pct,   print_cpu_pct },
+       { FIELD_MEM,       "MEM(k)",    10, compare_mem,       print_mem     },
+       { FIELD_MEM_PCT,   "MEM(%)",     6, compare_mem,       print_mem_pct },
+       { FIELD_MAXMEM,    "MAXMEM(k)", 10, compare_maxmem,    print_maxmem  },
+       { FIELD_MAX_PCT,   "MAXMEM(%)",  9, compare_maxmem,    print_max_pct },
+       { FIELD_VCPUS,     "VCPUS",      5, compare_vcpus,     print_vcpus   },
+       { FIELD_NETS,      "NETS",       4, compare_nets,      print_nets    },
+       { FIELD_NET_TX,    "NETTX(k)",   8, compare_net_tx,    print_net_tx  },
+       { FIELD_NET_RX,    "NETRX(k)",   8, compare_net_rx,    print_net_rx  },
+       { FIELD_VBDS,      "VBDS",       4, compare_vbds,      print_vbds    },
+       { FIELD_VBD_OO,    "VBD_OO",     8, compare_vbd_oo,    print_vbd_oo  },
+       { FIELD_VBD_RD,    "VBD_RD",     8, compare_vbd_rd,    print_vbd_rd  },
+       { FIELD_VBD_WR,    "VBD_WR",     8, compare_vbd_wr,    print_vbd_wr  },
+       { FIELD_VBD_RSECT, "VBD_RSECT", 10, compare_vbd_rsect, print_vbd_rsect  
},
+       { FIELD_VBD_WSECT, "VBD_WSECT", 10, compare_vbd_wsect, print_vbd_wsect  
},
+       { FIELD_SSID,      "SSID",       4, compare_ssid,      print_ssid    }
 };
 
 const unsigned int NUM_FIELDS = sizeof(fields)/sizeof(field);
@@ -685,20 +693,51 @@ static void print_vbd_rd(xenstat_domain 
    returning -1,0,1 * for <,=,> */
 static int compare_vbd_wr(xenstat_domain *domain1, xenstat_domain *domain2)
 {
-       return -compare(tot_vbd_reqs(domain1,FIELD_VBD_WR),
-                       tot_vbd_reqs(domain2,FIELD_VBD_WR));
+       return -compare(tot_vbd_reqs(domain1, FIELD_VBD_WR),
+                       tot_vbd_reqs(domain2, FIELD_VBD_WR));
 }
 
 /* Prints number of total VBD WRITE requests statistic */
 static void print_vbd_wr(xenstat_domain *domain)
 {
-       print("%8llu", tot_vbd_reqs(domain,FIELD_VBD_WR));
-}
+       print("%8llu", tot_vbd_reqs(domain, FIELD_VBD_WR));
+}
+
+/* Compares number of total VBD READ sectors of two domains,
+   returning -1,0,1 * for <,=,> */
+static int compare_vbd_rsect(xenstat_domain *domain1, xenstat_domain *domain2)
+{
+       return -compare(tot_vbd_reqs(domain1, FIELD_VBD_RSECT),
+                       tot_vbd_reqs(domain2, FIELD_VBD_RSECT));
+}
+
+/* Prints number of total VBD READ sectors statistic */
+static void print_vbd_rsect(xenstat_domain *domain)
+{
+       print("%10llu", tot_vbd_reqs(domain, FIELD_VBD_RSECT));
+}
+
+/* Compares number of total VBD WRITE sectors of two domains,
+   returning -1,0,1 * for <,=,> */
+static int compare_vbd_wsect(xenstat_domain *domain1, xenstat_domain *domain2)
+{
+       return -compare(tot_vbd_reqs(domain1, FIELD_VBD_WSECT),
+                       tot_vbd_reqs(domain2, FIELD_VBD_WSECT));
+}
+
+/* Prints number of total VBD WRITE sectors statistic */
+static void print_vbd_wsect(xenstat_domain *domain)
+{
+       print("%10llu", tot_vbd_reqs(domain, FIELD_VBD_WSECT));
+}
+
 
 /* Gets number of total VBD requests statistic, 
  *   if flag is FIELD_VBD_OO, then OO requests,
- *   if flag is FIELD_VBD_RD, then READ requests and
- *   if flag is FIELD_VBD_WR, then WRITE requests.
+ *   if flag is FIELD_VBD_RD, then READ requests,
+ *   if flag is FIELD_VBD_WR, then WRITE requests,
+ *   if flag is FIELD_VBD_RSECT, then READ sectors,
+ *   if flag is FIELD_VBD_WSECT, then WRITE sectors.
  */
 static unsigned long long tot_vbd_reqs(xenstat_domain *domain, int flag)
 {
@@ -721,6 +760,12 @@ static unsigned long long tot_vbd_reqs(x
                case FIELD_VBD_WR:
                        total += xenstat_vbd_wr_reqs(vbd);
                        break;
+               case FIELD_VBD_RSECT:
+                       total += xenstat_vbd_rd_sects(vbd);
+                       break;
+               case FIELD_VBD_WSECT:
+                       total += xenstat_vbd_wr_sects(vbd);
+                       break;
                default:
                        break;
                }
@@ -950,12 +995,14 @@ void do_vbd(xenstat_domain *domain)
                         MINOR(xenstat_vbd_dev(vbd)));
 #endif
 
-               print("VBD %s %4d %s OO: %8llu   RD: %8llu   WR: %8llu\n",
+               print("VBD %s %4d %s OO: %8llu   RD: %8llu   WR: %8llu   RSECT: 
%10llu   WSECT: %10llu\n",
                      vbd_type[xenstat_vbd_type(vbd)],
                      xenstat_vbd_dev(vbd), details,
                      xenstat_vbd_oo_reqs(vbd),
                      xenstat_vbd_rd_reqs(vbd),
-                     xenstat_vbd_wr_reqs(vbd));
+                     xenstat_vbd_wr_reqs(vbd),
+                     xenstat_vbd_rd_sects(vbd),
+                     xenstat_vbd_wr_sects(vbd));
        }
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xentop: Add two more VBD statistics, Xen patchbot-unstable <=