ia64/xen-unstable

changeset 9916:028f80cf0c99

This patch conditionalizes some output from perfc_printall(), thus making relevant information more compact and easier
legible. It additionally changes the formatting so that trailing spaces are avoided.

Also changing the type of some variables from plain int to unsigned int, as that is yielding more efficient code on
x86-64 (signed 32-bit array indices require explicit sign extension, whereas in most cases an extra copy can be avoided
when the index type is unsigned, since all 32-bit operations already zero-extend their results).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 02 15:33:47 2006 +0100 (2006-05-02)
parents 7af8039b3c57
children 42c73f3d7ac1
files xen/common/perfc.c
line diff
     1.1 --- a/xen/common/perfc.c	Tue May 02 15:21:19 2006 +0100
     1.2 +++ b/xen/common/perfc.c	Tue May 02 15:33:47 2006 +0100
     1.3 @@ -37,7 +37,7 @@ struct perfcounter perfcounters;
     1.4  
     1.5  void perfc_printall(unsigned char key)
     1.6  {
     1.7 -    int i, j, sum;
     1.8 +    unsigned int i, j, sum;
     1.9      s_time_t now = NOW();
    1.10      atomic_t *counters = (atomic_t *)&perfcounters;
    1.11  
    1.12 @@ -59,22 +59,28 @@ void perfc_printall(unsigned char key)
    1.13              sum = 0;
    1.14              for_each_online_cpu ( j )
    1.15                  sum += atomic_read(&counters[j]);
    1.16 -            printk("TOTAL[%10d]  ", sum);
    1.17 -            for_each_online_cpu ( j )
    1.18 -                printk("CPU%02d[%10d]  ", j, atomic_read(&counters[j]));
    1.19 +            printk("TOTAL[%10u]", sum);
    1.20 +            if (sum)
    1.21 +            {
    1.22 +                for_each_online_cpu ( j )
    1.23 +                    printk("  CPU%02d[%10d]", j, atomic_read(&counters[j]));
    1.24 +            }
    1.25              counters += NR_CPUS;
    1.26              break;
    1.27          case TYPE_ARRAY:
    1.28          case TYPE_S_ARRAY:
    1.29              for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ )
    1.30                  sum += atomic_read(&counters[j]);
    1.31 -            printk("TOTAL[%10d]  ", sum);
    1.32 +            printk("TOTAL[%10u]", sum);
    1.33  #ifdef PERF_ARRAYS
    1.34 -            for ( j = 0; j < perfc_info[i].nr_elements; j++ )
    1.35 +            if (sum)
    1.36              {
    1.37 -                if ( (j != 0) && ((j % 4) == 0) )
    1.38 -                    printk("\n                   ");
    1.39 -                printk("ARR%02d[%10d]  ", j, atomic_read(&counters[j]));
    1.40 +                for ( j = 0; j < perfc_info[i].nr_elements; j++ )
    1.41 +                {
    1.42 +                    if ( (j % 4) == 0 )
    1.43 +                        printk("\n                 ");
    1.44 +                    printk("  ARR%02d[%10d]", j, atomic_read(&counters[j]));
    1.45 +                }
    1.46              }
    1.47  #endif
    1.48              counters += j;
    1.49 @@ -90,7 +96,7 @@ void perfc_printall(unsigned char key)
    1.50  
    1.51  void perfc_reset(unsigned char key)
    1.52  {
    1.53 -    int i, j;
    1.54 +    unsigned int i, j;
    1.55      s_time_t now = NOW();
    1.56      atomic_t *counters = (atomic_t *)&perfcounters;
    1.57