direct-io.hg

changeset 479:9d17614e07e4

bitkeeper revision 1.242.1.1 (3ee5b2e6yiamD8UfKwvKw39hVfWFpg)

dom0_ops.h, dom0_ops.c:
added CPU time to the list of values returned by a DOM0_GETDOMAININFO call
dom0_core.c:
added a /proc/xeno/dom<n>/usage entry for tracking resource usage
author rgr22@boulderdash.cl.cam.ac.uk
date Tue Jun 10 10:28:54 2003 +0000 (2003-06-10)
parents 4b5c3faedda5
children 7596ce7d70f3
files BitKeeper/etc/logging_ok xen/common/dom0_ops.c xen/include/xeno/dom0_ops.h xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_core.c xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Sun May 18 12:50:42 2003 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Tue Jun 10 10:28:54 2003 +0000
     1.3 @@ -15,6 +15,7 @@ kaf24@plym.cl.cam.ac.uk
     1.4  kaf24@scramble.cl.cam.ac.uk
     1.5  kaf24@striker.cl.cam.ac.uk
     1.6  lynx@idefix.cl.cam.ac.uk
     1.7 +rgr22@boulderdash.cl.cam.ac.uk
     1.8  rn@wyvis.camb.intel-research.net
     1.9  rn@wyvis.research.intel-research.net
    1.10  smh22@boulderdash.cl.cam.ac.uk
     2.1 --- a/xen/common/dom0_ops.c	Sun May 18 12:50:42 2003 +0000
     2.2 +++ b/xen/common/dom0_ops.c	Tue Jun 10 10:28:54 2003 +0000
     2.3 @@ -236,6 +236,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     2.4                  list_entry(p->pg_head.next, struct pfn_info, list) -
     2.5                  frame_table;
     2.6              op.u.getdominfo.tot_pages   = p->tot_pages;
     2.7 +            op.u.getdominfo.cpu_time    = p->cpu_time;
     2.8          }
     2.9  
    2.10          read_unlock_irqrestore(&tasklist_lock, flags);
     3.1 --- a/xen/include/xeno/dom0_ops.h	Sun May 18 12:50:42 2003 +0000
     3.2 +++ b/xen/include/xeno/dom0_ops.h	Tue Jun 10 10:28:54 2003 +0000
     3.3 @@ -85,6 +85,7 @@ typedef struct dom0_getdominfo_st
     3.4    unsigned long mcu_advance;
     3.5    unsigned long pg_head;
     3.6    unsigned int tot_pages;
     3.7 +  long long cpu_time;
     3.8  } dom0_getdominfo_t;
     3.9  
    3.10  
     4.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_core.c	Sun May 18 12:50:42 2003 +0000
     4.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_core.c	Tue Jun 10 10:28:54 2003 +0000
     4.3 @@ -55,6 +55,7 @@ typedef struct proc_mem_data {
     4.4  #define DOM_DIR         "dom"
     4.5  #define DOM_MEM         "mem"
     4.6  #define DOM_VIF         "vif"
     4.7 +#define DOM_USAGE       "usage"
     4.8  
     4.9  #define MAP_DISCONT     1
    4.10  
    4.11 @@ -112,6 +113,39 @@ struct file_operations dom_vif_ops = {
    4.12      read:    dom_vif_read
    4.13  };
    4.14  
    4.15 +static ssize_t dom_usage_read(struct file * file, char * buff, size_t size, loff_t * off)
    4.16 +{
    4.17 +    char hyp_buf[128];
    4.18 +    dom0_op_t op;
    4.19 +    static int finished = 0;
    4.20 +
    4.21 +    if ( finished )
    4.22 +    {
    4.23 +        finished = 0;
    4.24 +        return 0;
    4.25 +    }
    4.26 +
    4.27 +    op.cmd = DOM0_GETDOMAININFO;
    4.28 +    op.u.getdominfo.domain = (unsigned int)
    4.29 +        ((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data;
    4.30 +
    4.31 +    (void)HYPERVISOR_dom0_op(&op);
    4.32 +
    4.33 +    snprintf(hyp_buf, 128, "cpu: %lld\n", op.u.getdominfo.cpu_time);
    4.34 +
    4.35 +    if (*off >= (strlen(hyp_buf) + 1)) return 0;
    4.36 +    
    4.37 +    copy_to_user(buff, hyp_buf, strlen(hyp_buf));
    4.38 +
    4.39 +    finished = 1;
    4.40 +
    4.41 +    return strlen(hyp_buf) + 1;
    4.42 +}
    4.43 +
    4.44 +struct file_operations dom_usage_ops = {
    4.45 +    read:    dom_usage_read
    4.46 +};
    4.47 +
    4.48  
    4.49  static void create_proc_dom_entries(int dom)
    4.50  {
    4.51 @@ -136,6 +170,15 @@ static void create_proc_dom_entries(int 
    4.52          file->proc_fops     = &dom_vif_ops;
    4.53          file->data          = (void *) dom;
    4.54      }
    4.55 +
    4.56 +    file = create_proc_entry(DOM_USAGE, 0600, dir);
    4.57 +    if (file != NULL)
    4.58 +    {
    4.59 +        file->owner         = THIS_MODULE;
    4.60 +        file->nlink         = 1;
    4.61 +        file->proc_fops     = &dom_usage_ops;
    4.62 +        file->data          = (void *) dom;
    4.63 +    }
    4.64  }
    4.65  
    4.66  static ssize_t dom_mem_write(struct file * file, const char * buff, 
     5.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h	Sun May 18 12:50:42 2003 +0000
     5.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_ops.h	Tue Jun 10 10:28:54 2003 +0000
     5.3 @@ -102,6 +102,7 @@ typedef struct dom0_getdominfo_st
     5.4    unsigned long mcu_advance;
     5.5    unsigned long pg_head;
     5.6    unsigned int tot_pages;
     5.7 +  long long cpu_time;
     5.8  } dom0_getdominfo_t;
     5.9  
    5.10