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

[Xen-changelog] [xen-unstable] xenpm tool: add average C state residency



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1234868911 0
# Node ID 6e9daf1dc5b3ac94f2f01ca02c6f090aca70802c
# Parent  261ccf78bea65e2a2d8f1e33e21c90f85ad7faff
xenpm tool: add average C state residency

Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>
---
 tools/misc/xenpm.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff -r 261ccf78bea6 -r 6e9daf1dc5b3 tools/misc/xenpm.c
--- a/tools/misc/xenpm.c        Tue Feb 17 11:07:29 2009 +0000
+++ b/tools/misc/xenpm.c        Tue Feb 17 11:08:31 2009 +0000
@@ -303,35 +303,34 @@ static void signal_int_handler(int signo
     printf("Elapsed time (ms): %"PRIu64"\n", (usec_end - usec_start) / 1000UL);
     for ( i = 0; i < max_cpu_nr; i++ )
     {
-        uint64_t temp;
-        printf("CPU%d:\n\tresidency\tpercentage\n", i);
-        if ( cx_cap )
+        uint64_t res, triggers;
+        double avg_res;
+
+        printf("\nCPU%d:\tResidency(ms)\t\tAvg Res(ms)\n",i);
+        if ( cx_cap && sum_cx[i] > 0 )
         {
             for ( j = 0; j < cxstat_end[i].nr; j++ )
             {
-                if ( sum_cx[i] > 0 )
-                {
-                    temp = cxstat_end[i].residencies[j] -
-                           cxstat_start[i].residencies[j];
-                    printf("  C%d\t%"PRIu64" ms\t%.2f%%\n", j,
-                           temp / 1000000UL, 100UL * temp / (double)sum_cx[i]);
-                }
+                res = cxstat_end[i].residencies[j] -
+                    cxstat_start[i].residencies[j];
+                triggers = cxstat_end[i].triggers[j] -
+                    cxstat_start[i].triggers[j];
+                avg_res = (triggers==0) ? 0: (double)res/triggers/1000000.0;
+                printf("  C%d\t%"PRIu64"\t(%5.2f%%)\t%.2f\n", j, res/1000000UL,
+                        100 * res / (double)sum_cx[i], avg_res );
             }
+            printf("\n");
         }
-        if ( px_cap )
+        if ( px_cap && sum_px[i]>0 )
         {
             for ( j = 0; j < pxstat_end[i].total; j++ )
             {
-                if ( sum_px[i] > 0 )
-                {
-                    temp = pxstat_end[i].pt[j].residency -
-                           pxstat_start[i].pt[j].residency;
-                    printf("  P%d\t%"PRIu64" ms\t%.2f%%\n", j,
-                           temp / 1000000UL, 100UL * temp / (double)sum_px[i]);
-                }
+                res = pxstat_end[i].pt[j].residency -
+                    pxstat_start[i].pt[j].residency;
+                printf("  P%d\t%"PRIu64"\t(%5.2f%%)\n", j,
+                        res / 1000000UL, 100UL * res / (double)sum_px[i]);
             }
         }
-        printf("\n");
     }
 
     /* some clean up and then exits */
@@ -408,6 +407,7 @@ void start_gather_func(int argc, char *a
         free(cxstat);
         return ;
     }
+    printf("Start sampling, waiting for CTRL-C or SIGINT signal ...\n");
 
     pause();
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.