ia64/xen-unstable

changeset 19219:6e9daf1dc5b3

xenpm tool: add average C state residency

Signed-off-by: Yu Ke <ke.yu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 17 11:08:31 2009 +0000 (2009-02-17)
parents 261ccf78bea6
children ac3ecce4502d
files tools/misc/xenpm.c
line diff
     1.1 --- a/tools/misc/xenpm.c	Tue Feb 17 11:07:29 2009 +0000
     1.2 +++ b/tools/misc/xenpm.c	Tue Feb 17 11:08:31 2009 +0000
     1.3 @@ -303,35 +303,34 @@ static void signal_int_handler(int signo
     1.4      printf("Elapsed time (ms): %"PRIu64"\n", (usec_end - usec_start) / 1000UL);
     1.5      for ( i = 0; i < max_cpu_nr; i++ )
     1.6      {
     1.7 -        uint64_t temp;
     1.8 -        printf("CPU%d:\n\tresidency\tpercentage\n", i);
     1.9 -        if ( cx_cap )
    1.10 +        uint64_t res, triggers;
    1.11 +        double avg_res;
    1.12 +
    1.13 +        printf("\nCPU%d:\tResidency(ms)\t\tAvg Res(ms)\n",i);
    1.14 +        if ( cx_cap && sum_cx[i] > 0 )
    1.15          {
    1.16              for ( j = 0; j < cxstat_end[i].nr; j++ )
    1.17              {
    1.18 -                if ( sum_cx[i] > 0 )
    1.19 -                {
    1.20 -                    temp = cxstat_end[i].residencies[j] -
    1.21 -                           cxstat_start[i].residencies[j];
    1.22 -                    printf("  C%d\t%"PRIu64" ms\t%.2f%%\n", j,
    1.23 -                           temp / 1000000UL, 100UL * temp / (double)sum_cx[i]);
    1.24 -                }
    1.25 +                res = cxstat_end[i].residencies[j] -
    1.26 +                    cxstat_start[i].residencies[j];
    1.27 +                triggers = cxstat_end[i].triggers[j] -
    1.28 +                    cxstat_start[i].triggers[j];
    1.29 +                avg_res = (triggers==0) ? 0: (double)res/triggers/1000000.0;
    1.30 +                printf("  C%d\t%"PRIu64"\t(%5.2f%%)\t%.2f\n", j, res/1000000UL,
    1.31 +                        100 * res / (double)sum_cx[i], avg_res );
    1.32              }
    1.33 +            printf("\n");
    1.34          }
    1.35 -        if ( px_cap )
    1.36 +        if ( px_cap && sum_px[i]>0 )
    1.37          {
    1.38              for ( j = 0; j < pxstat_end[i].total; j++ )
    1.39              {
    1.40 -                if ( sum_px[i] > 0 )
    1.41 -                {
    1.42 -                    temp = pxstat_end[i].pt[j].residency -
    1.43 -                           pxstat_start[i].pt[j].residency;
    1.44 -                    printf("  P%d\t%"PRIu64" ms\t%.2f%%\n", j,
    1.45 -                           temp / 1000000UL, 100UL * temp / (double)sum_px[i]);
    1.46 -                }
    1.47 +                res = pxstat_end[i].pt[j].residency -
    1.48 +                    pxstat_start[i].pt[j].residency;
    1.49 +                printf("  P%d\t%"PRIu64"\t(%5.2f%%)\n", j,
    1.50 +                        res / 1000000UL, 100UL * res / (double)sum_px[i]);
    1.51              }
    1.52          }
    1.53 -        printf("\n");
    1.54      }
    1.55  
    1.56      /* some clean up and then exits */
    1.57 @@ -408,6 +407,7 @@ void start_gather_func(int argc, char *a
    1.58          free(cxstat);
    1.59          return ;
    1.60      }
    1.61 +    printf("Start sampling, waiting for CTRL-C or SIGINT signal ...\n");
    1.62  
    1.63      pause();
    1.64  }