ia64/xen-unstable

changeset 15287:d47415adf384

xenstat: Adding to scan blktap information.
Signed-off-by: Satoshi UCHIDA <s-uchida@ap.jp.nec.com>
author kfraser@localhost.localdomain
date Thu Jun 07 11:13:41 2007 +0100 (2007-06-07)
parents 9c2322a4c348
children 3a413f011b8f
files tools/xenstat/libxenstat/src/xenstat.c tools/xenstat/libxenstat/src/xenstat.h tools/xenstat/libxenstat/src/xenstat_linux.c tools/xenstat/libxenstat/src/xenstat_priv.h
line diff
     1.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Thu Jun 07 11:06:00 2007 +0100
     1.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Thu Jun 07 11:13:41 2007 +0100
     1.3 @@ -625,6 +625,12 @@ static void xenstat_free_vbds(xenstat_no
     1.4  		free(node->domains[i].vbds);
     1.5  }
     1.6  
     1.7 +/* Get the back driver type  for Virtual Block Device */
     1.8 +unsigned int xenstat_vbd_type(xenstat_vbd * vbd)
     1.9 +{
    1.10 +	return vbd->back_type;
    1.11 +}
    1.12 +
    1.13  /* Get the major number of VBD device */
    1.14  unsigned int xenstat_vbd_dev(xenstat_vbd * vbd)
    1.15  {
     2.1 --- a/tools/xenstat/libxenstat/src/xenstat.h	Thu Jun 07 11:06:00 2007 +0100
     2.2 +++ b/tools/xenstat/libxenstat/src/xenstat.h	Thu Jun 07 11:13:41 2007 +0100
     2.3 @@ -172,6 +172,10 @@ unsigned long long xenstat_network_tdrop
     2.4  /*
     2.5   * VBD functions - extract information from a xen_vbd
     2.6   */
     2.7 +
     2.8 +/* Get the back driver type  for Virtual Block Device */
     2.9 +unsigned int xenstat_vbd_type(xenstat_vbd * vbd);
    2.10 +
    2.11  /* Get the device number for Virtual Block Device */
    2.12  unsigned int xenstat_vbd_dev(xenstat_vbd * vbd);
    2.13  
     3.1 --- a/tools/xenstat/libxenstat/src/xenstat_linux.c	Thu Jun 07 11:06:00 2007 +0100
     3.2 +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c	Thu Jun 07 11:13:41 2007 +0100
     3.3 @@ -204,17 +204,23 @@ int xenstat_collect_vbds(xenstat_node * 
     3.4  		int ret;
     3.5  		char buf[256];
     3.6  
     3.7 +		ret = sscanf(dp->d_name, "%3s-%u-%u", buf, &domid, &vbd.dev);
     3.8 +		if (ret != 3)
     3.9 +			continue;
    3.10  
    3.11 -		ret = sscanf(dp->d_name, "vbd-%u-%u", &domid, &vbd.dev);
    3.12 -		if (ret != 2)
    3.13 +		if (strcmp(buf,"vbd") == 0)
    3.14 +			vbd.back_type = 1;
    3.15 +		else if (strcmp(buf,"tap") == 0)
    3.16 +			vbd.back_type = 2;
    3.17 +		else
    3.18  			continue;
    3.19  
    3.20  		domain = xenstat_node_domain(node, domid);
    3.21  		if (domain == NULL) {
    3.22  			fprintf(stderr,
    3.23 -				"Found interface vbd-%u-%u but domain %u"
    3.24 +				"Found interface %s-%u-%u but domain %u"
    3.25  				" does not exist.\n",
    3.26 -				domid, vbd.dev, domid);
    3.27 +				buf, domid, vbd.dev, domid);
    3.28  			continue;
    3.29  		}
    3.30  
     4.1 --- a/tools/xenstat/libxenstat/src/xenstat_priv.h	Thu Jun 07 11:06:00 2007 +0100
     4.2 +++ b/tools/xenstat/libxenstat/src/xenstat_priv.h	Thu Jun 07 11:13:41 2007 +0100
     4.3 @@ -87,10 +87,11 @@ struct xenstat_network {
     4.4  };
     4.5  
     4.6  struct xenstat_vbd {
     4.7 -       unsigned int dev;
     4.8 -       unsigned long long oo_reqs;
     4.9 -       unsigned long long rd_reqs;
    4.10 -       unsigned long long wr_reqs;
    4.11 +	unsigned int back_type;
    4.12 +	unsigned int dev;
    4.13 +	unsigned long long oo_reqs;
    4.14 +	unsigned long long rd_reqs;
    4.15 +	unsigned long long wr_reqs;
    4.16  };
    4.17  
    4.18  extern int xenstat_collect_networks(xenstat_node * node);