All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] adjust performance counter printing
@ 2006-05-02 14:21 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2006-05-02 14:21 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

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>


[-- Attachment #2: xen-perfc-formatting.patch --]
[-- Type: text/plain, Size: 2072 bytes --]

--- 2006-04-27/xen/common/perfc.c.0	2006-04-06 17:50:26.000000000 +0200
+++ 2006-04-27/xen/common/perfc.c	2006-05-02 15:49:42.000000000 +0200
@@ -37,7 +37,7 @@ struct perfcounter perfcounters;
 
 void perfc_printall(unsigned char key)
 {
-    int i, j, sum;
+    unsigned int i, j, sum;
     s_time_t now = NOW();
     atomic_t *counters = (atomic_t *)&perfcounters;
 
@@ -59,22 +59,28 @@ void perfc_printall(unsigned char key)
             sum = 0;
             for_each_online_cpu ( j )
                 sum += atomic_read(&counters[j]);
-            printk("TOTAL[%10d]  ", sum);
-            for_each_online_cpu ( j )
-                printk("CPU%02d[%10d]  ", j, atomic_read(&counters[j]));
+            printk("TOTAL[%10u]", sum);
+            if (sum)
+            {
+                for_each_online_cpu ( j )
+                    printk("  CPU%02d[%10d]", j, atomic_read(&counters[j]));
+            }
             counters += NR_CPUS;
             break;
         case TYPE_ARRAY:
         case TYPE_S_ARRAY:
             for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ )
                 sum += atomic_read(&counters[j]);
-            printk("TOTAL[%10d]  ", sum);
+            printk("TOTAL[%10u]", sum);
 #ifdef PERF_ARRAYS
-            for ( j = 0; j < perfc_info[i].nr_elements; j++ )
+            if (sum)
             {
-                if ( (j != 0) && ((j % 4) == 0) )
-                    printk("\n                   ");
-                printk("ARR%02d[%10d]  ", j, atomic_read(&counters[j]));
+                for ( j = 0; j < perfc_info[i].nr_elements; j++ )
+                {
+                    if ( (j % 4) == 0 )
+                        printk("\n                 ");
+                    printk("  ARR%02d[%10d]", j, atomic_read(&counters[j]));
+                }
             }
 #endif
             counters += j;
@@ -90,7 +96,7 @@ void perfc_printall(unsigned char key)
 
 void perfc_reset(unsigned char key)
 {
-    int i, j;
+    unsigned int i, j;
     s_time_t now = NOW();
     atomic_t *counters = (atomic_t *)&perfcounters;
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-02 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-02 14:21 [PATCH] adjust performance counter printing Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.