[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenpm: Fix reporting of C0 residence times


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 30 May 2012 13:22:20 +0000
  • Delivery-date: Wed, 30 May 2012 13:22:25 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Boris Ostrovsky <boris.ostrovsky@xxxxxxx>
# Date 1338366362 -3600
# Node ID ff16fb989c14a040134d2e49e739b703dc1bfa06
# Parent  6f7d9bb88e83cc16fe5785730289c1a925a2c129
xenpm: Fix reporting of C0 residence times

Idle state residence times as provided by pmstat_get_cx_stat() are not
reported precisely since remote core may be in idle state and
therefore has not updated its statistics at the time local core
collected them.  This causes C0 residencies as calculated by xenpm to
sometimes become negative.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 6f7d9bb88e83 -r ff16fb989c14 tools/misc/xenpm.c
--- a/tools/misc/xenpm.c        Wed May 30 09:25:11 2012 +0100
+++ b/tools/misc/xenpm.c        Wed May 30 09:26:02 2012 +0100
@@ -351,8 +351,12 @@ static void signal_int_handler(int signo
         for ( i = 0; i < max_cpu_nr; i++ )
             if ( !get_cxstat_by_cpuid(xc_handle, i, &cxstat_end[i]) )
                 for ( j = 0; j < cxstat_end[i].nr; j++ )
-                    sum_cx[i] += cxstat_end[i].residencies[j] -
-                                 cxstat_start[i].residencies[j];
+                {
+                    int64_t diff = (int64_t)cxstat_end[i].residencies[j] -
+                        (int64_t)cxstat_start[i].residencies[j];
+                    if ( diff >=0 )
+                        sum_cx[i] += diff;
+                }
     }
 
     if ( get_pxstat_by_cpuid(xc_handle, 0, NULL) != -ENODEV )
@@ -379,8 +383,10 @@ static void signal_int_handler(int signo
         {
             for ( j = 0; j < cxstat_end[i].nr; j++ )
             {
-                res = cxstat_end[i].residencies[j] -
-                    cxstat_start[i].residencies[j];
+                int64_t diff = (int64_t)cxstat_end[i].residencies[j] -
+                    (int64_t)cxstat_start[i].residencies[j];
+
+                res = ( diff >= 0 ) ? diff : 0;
                 triggers = cxstat_end[i].triggers[j] -
                     cxstat_start[i].triggers[j];
                 avg_res = (triggers==0) ? 0: (double)res/triggers/1000000.0;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.