ia64/xen-unstable

changeset 1413:57530115a37e

bitkeeper revision 1.918 (40ad05295f3vfOtWjADTgFv05BpG9w)

migrate improvements
author iap10@labyrinth.cl.cam.ac.uk
date Thu May 20 19:21:13 2004 +0000 (2004-05-20)
parents 7843b8fd800f
children 8a0e1dd5dd76
files tools/xc/lib/xc_linux_save.c tools/xc/py/Xc.c xen/common/dom0_ops.c xen/common/domain.c
line diff
     1.1 --- a/tools/xc/lib/xc_linux_save.c	Thu May 20 17:43:25 2004 +0000
     1.2 +++ b/tools/xc/lib/xc_linux_save.c	Thu May 20 19:21:13 2004 +0000
     1.3 @@ -93,51 +93,44 @@ long long tvdelta( struct timeval *new, 
     1.4  	(new->tv_usec - old->tv_usec);
     1.5  }
     1.6  
     1.7 -int track_cpu_usage_dom0( int xc_handle, int print )
     1.8 +int track_cpu_usage( int xc_handle, u64 domid, int pages, int print )
     1.9  {
    1.10      static struct timeval wall_last;
    1.11 -    static long long      cpu_last;
    1.12 +    static long long      d0_cpu_last;
    1.13 +    static long long      d1_cpu_last;
    1.14  
    1.15      struct timeval        wall_now;
    1.16 -    long long             cpu_now, wall_delta, cpu_delta;
    1.17 +    long long             wall_delta;
    1.18 +    long long             d0_cpu_now, d0_cpu_delta;
    1.19 +    long long             d1_cpu_now, d1_cpu_delta;
    1.20 +
    1.21  
    1.22      gettimeofday(&wall_now, NULL);
    1.23  
    1.24 -    cpu_now = xc_domain_get_cpu_usage( xc_handle, 0 )/1000;
    1.25 +    d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0 )/1000;
    1.26 +    d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid )/1000;
    1.27 +
    1.28 +    if ( d0_cpu_now == -1 || d1_cpu_now == -1 )	
    1.29 +    {
    1.30 +	printf("ARRHHH!!\n");
    1.31 +    }
    1.32  
    1.33      wall_delta = tvdelta(&wall_now,&wall_last)/1000;
    1.34 -    cpu_delta  = (cpu_now - cpu_last)/1000;
    1.35 +
    1.36 +    if ( wall_delta == 0 ) wall_delta = 1;
    1.37 +
    1.38 +    d0_cpu_delta  = (d0_cpu_now - d0_cpu_last)/1000;
    1.39 +    d1_cpu_delta  = (d1_cpu_now - d1_cpu_last)/1000;
    1.40  
    1.41      if(print)
    1.42 -	printf("Dom0  : wall delta %lldms, cpu delta %lldms    : %d%%\n",
    1.43 -	   wall_delta, cpu_delta, (cpu_delta*100)/wall_delta);
    1.44 -
    1.45 -    cpu_last  = cpu_now;
    1.46 -    wall_last = wall_now;	
    1.47 -
    1.48 -    return 0;
    1.49 -}
    1.50 -
    1.51 -int track_cpu_usage_target( int xc_handle, u64 domid, int print )
    1.52 -{
    1.53 -    static struct timeval wall_last;
    1.54 -    static long long      cpu_last;
    1.55 +	printf("interval %lldms, dom0 used %lldms (%d%%), target used %lldms (%d%%), b/w %dMb/s\n",
    1.56 +	       wall_delta, 
    1.57 +	       d0_cpu_delta, (int)((d0_cpu_delta*100)/wall_delta),
    1.58 +	       d1_cpu_delta, (int)((d1_cpu_delta*100)/wall_delta),
    1.59 +	       (int)((pages*PAGE_SIZE*8)/(wall_delta*1000)));
    1.60  
    1.61 -    struct timeval        wall_now;
    1.62 -    long long             cpu_now, wall_delta, cpu_delta;
    1.63 -
    1.64 -    gettimeofday(&wall_now, NULL);
    1.65 -
    1.66 -    cpu_now = xc_domain_get_cpu_usage( xc_handle, domid )/1000;
    1.67 -
    1.68 -    wall_delta = tvdelta(&wall_now,&wall_last)/1000;
    1.69 -    cpu_delta  = (cpu_now - cpu_last)/1000;
    1.70 -
    1.71 -    if(print)
    1.72 -	printf("Target: wall delta %lldms, cpu delta %lldms    : %d%%\n",
    1.73 -	   wall_delta, cpu_delta, (cpu_delta*100)/wall_delta);
    1.74 -
    1.75 -    cpu_last  = cpu_now;
    1.76 +    d0_cpu_last  = d0_cpu_now;
    1.77 +    d1_cpu_last  = d1_cpu_now;
    1.78      wall_last = wall_now;	
    1.79  
    1.80      return 0;
    1.81 @@ -422,8 +415,7 @@ int xc_linux_save(int xc_handle,
    1.82          goto out;
    1.83      }
    1.84  
    1.85 -    track_cpu_usage_dom0(xc_handle, 0);
    1.86 -    track_cpu_usage_target( xc_handle, domid, 0);
    1.87 +    track_cpu_usage( xc_handle, domid, 0, 0);
    1.88  
    1.89      /* Now write out each data page, canonicalising page tables as we go... */
    1.90      
    1.91 @@ -657,9 +649,7 @@ int xc_linux_save(int xc_handle,
    1.92  	verbose_printf("\b\b\b\b100%% (pages sent= %d, skipped= %d )\n", 
    1.93  		       sent_this_iter, skip_this_iter );
    1.94  
    1.95 -	track_cpu_usage_dom0(xc_handle, 1);
    1.96 -	track_cpu_usage_target( xc_handle, domid, 1);
    1.97 -
    1.98 +	track_cpu_usage( xc_handle, domid, sent_this_iter, 1);
    1.99  	
   1.100  	if ( last_iter )
   1.101  	{
     2.1 --- a/tools/xc/py/Xc.c	Thu May 20 17:43:25 2004 +0000
     2.2 +++ b/tools/xc/py/Xc.c	Thu May 20 19:21:13 2004 +0000
     2.3 @@ -318,6 +318,10 @@ static PyObject *pyxc_linux_save(PyObjec
     2.4  
     2.5  	if ( xc_linux_save(xc->xc_handle, dom, flags, writerfn, gfd) == 0 )
     2.6  	{
     2.7 +	    /* kill domain. We don't want to do this for checkpointing, but
     2.8 +	       if we don't do it here I think people will hurt themselves
     2.9 +	       by accident... */
    2.10 +	    xc_domain_destroy( xc->xc_handle, dom, 1 );
    2.11  	    gzclose(gfd);
    2.12  	    close(fd);
    2.13  
     3.1 --- a/xen/common/dom0_ops.c	Thu May 20 17:43:25 2004 +0000
     3.2 +++ b/xen/common/dom0_ops.c	Thu May 20 19:21:13 2004 +0000
     3.3 @@ -113,7 +113,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     3.4  	if( ret == 0 && op->u.stopdomain.sync == 1 )
     3.5  	{
     3.6  	    extern long do_block( void );
     3.7 -	    printk("T\n");
     3.8  	    do_block(); // Yuk...
     3.9  	}
    3.10      }
     4.1 --- a/xen/common/domain.c	Thu May 20 17:43:25 2004 +0000
     4.2 +++ b/xen/common/domain.c	Thu May 20 19:21:13 2004 +0000
     4.3 @@ -271,7 +271,6 @@ void stop_domain(void)
     4.4         kick Dom0 */
     4.5      {
     4.6  	struct task_struct *p;
     4.7 -	printk("S\n");
     4.8  	guest_schedule_to_run( p = find_domain_by_id(0ULL) );
     4.9  	put_task_struct(p);
    4.10      }