ia64/xen-unstable

changeset 291:0f1c9bea587e

bitkeeper revision 1.122.1.10 (3e70a344_miNFwTDQHx7TSuaWoY4lA)

Merge ssh://rn212@gauntlet.cl.cam.ac.uk//usr/groups/xeno/BK/xeno.bk
into wyvis.research.intel-research.net:/home/rn/src/xeno/xeno.bk
author rn@wyvis.research.intel-research.net
date Thu Mar 13 15:27:00 2003 +0000 (2003-03-13)
parents 8f2787ce13b2 f6b756356385
children b81917bfa7f8
files BitKeeper/etc/logging_ok xen/arch/i386/apic.c xen/arch/i386/irq.c xen/common/ac_timer.c xen/common/keyhandler.c xen/common/perfc.c xen/include/xeno/perfc.h xen/include/xeno/perfc_defn.h
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Wed Mar 12 16:44:57 2003 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Thu Mar 13 15:27:00 2003 +0000
     1.3 @@ -10,5 +10,6 @@ kaf24@scramble.cl.cam.ac.uk
     1.4  kaf24@striker.cl.cam.ac.uk
     1.5  lynx@idefix.cl.cam.ac.uk
     1.6  rn@wyvis.camb.intel-research.net
     1.7 +rn@wyvis.research.intel-research.net
     1.8  smh22@boulderdash.cl.cam.ac.uk
     1.9  smh22@uridium.cl.cam.ac.uk
     2.1 --- a/xen/arch/i386/apic.c	Wed Mar 12 16:44:57 2003 +0000
     2.2 +++ b/xen/arch/i386/apic.c	Thu Mar 13 15:27:00 2003 +0000
     2.3 @@ -48,6 +48,8 @@
     2.4  
     2.5  #include <xeno/ac_timer.h>
     2.6  
     2.7 +#include <xeno/perfc.h>
     2.8 +
     2.9  #undef APIC_TIME_TRACE
    2.10  #ifdef APIC_TIME_TRACE
    2.11  #define TRC(_x) _x
    2.12 @@ -748,6 +750,7 @@ void smp_apic_timer_interrupt(struct pt_
    2.13  
    2.14  	/* call the local handler */
    2.15      irq_enter(cpu, 0);
    2.16 +	perfc_incrc(apic_timer);
    2.17      smp_local_timer_interrupt(regs);
    2.18      irq_exit(cpu, 0);
    2.19  
     3.1 --- a/xen/arch/i386/irq.c	Wed Mar 12 16:44:57 2003 +0000
     3.2 +++ b/xen/arch/i386/irq.c	Thu Mar 13 15:27:00 2003 +0000
     3.3 @@ -36,6 +36,7 @@
     3.4  #include <asm/pgalloc.h>
     3.5  #include <xeno/delay.h>
     3.6  
     3.7 +#include <xeno/perfc.h>
     3.8  
     3.9  /*
    3.10   * Linux has a controller-independent x86 interrupt architecture.
    3.11 @@ -469,6 +470,11 @@ asmlinkage unsigned int do_IRQ(struct pt
    3.12      struct irqaction * action;
    3.13      unsigned int status;
    3.14  
    3.15 +    u32     cc_start, cc_end;
    3.16 +
    3.17 +    perfc_incra(irqs, cpu);
    3.18 +    rdtscl(cc_start);
    3.19 +
    3.20      spin_lock(&desc->lock);
    3.21      desc->handler->ack(irq);
    3.22      /*
    3.23 @@ -530,6 +536,9 @@ asmlinkage unsigned int do_IRQ(struct pt
    3.24      if (softirq_pending(cpu))
    3.25          do_softirq();
    3.26  
    3.27 +    rdtscl(cc_end);
    3.28 +    perfc_adda(irq_time, cpu, cc_end - cc_start);
    3.29 +
    3.30      return 1;
    3.31  }
    3.32  
     4.1 --- a/xen/common/ac_timer.c	Wed Mar 12 16:44:57 2003 +0000
     4.2 +++ b/xen/common/ac_timer.c	Thu Mar 13 15:27:00 2003 +0000
     4.3 @@ -25,7 +25,8 @@
     4.4  #include <xeno/lib.h>
     4.5  #include <xeno/config.h>
     4.6  #include <xeno/smp.h>
     4.7 -#include <xeno/init.h>
     4.8 +
     4.9 +#include <xeno/perfc.h>
    4.10  
    4.11  #include <xeno/time.h>
    4.12  #include <xeno/ac_timer.h>
    4.13 @@ -34,10 +35,6 @@
    4.14  #include <asm/system.h>
    4.15  #include <asm/desc.h>
    4.16  
    4.17 -
    4.18 -#undef AC_TIMER_TRACE
    4.19 -#undef AC_TIMER_STATS
    4.20 -
    4.21  #ifdef AC_TIMER_TRACE
    4.22  #define TRC(_x) _x
    4.23  #else
    4.24 @@ -55,22 +52,10 @@ typedef struct ac_timers_st
    4.25  {
    4.26      spinlock_t lock;
    4.27      struct list_head timers;
    4.28 -    struct ac_timer *prev, *curr;
    4.29 +    s_time_t    max_diff;
    4.30  } __cacheline_aligned ac_timers_t;
    4.31  static ac_timers_t ac_timers[NR_CPUS];
    4.32  
    4.33 -#ifdef AC_TIMER_STATS
    4.34 -#define BUCKETS		1000
    4.35 -#define MAX_STATS
    4.36 -typedef struct act_stats_st
    4.37 -{
    4.38 -    u32 count;
    4.39 -    u32 times[2*(BUCKETS)];
    4.40 -} __cacheline_aligned act_stats_t;
    4.41 -static act_stats_t act_stats[NR_CPUS];
    4.42 -
    4.43 -#endif
    4.44 -
    4.45  /* local prototypes */
    4.46  static int  detach_ac_timer(struct ac_timer *timer);
    4.47  /*static void ac_timer_debug(unsigned long);*/
    4.48 @@ -172,14 +157,14 @@ static int detach_ac_timer(struct ac_tim
    4.49   */
    4.50  int rem_ac_timer(struct ac_timer *timer)
    4.51  {
    4.52 -    int 		  cpu = smp_processor_id();
    4.53 -    int           res;
    4.54 +    int           cpu = smp_processor_id();
    4.55 +    int           res = 0;
    4.56      unsigned long flags;
    4.57  
    4.58      TRC(printk("ACT  [%02d] remove(): timo=%lld \n", cpu, timer->expires));
    4.59 -
    4.60      spin_lock_irqsave(&ac_timers[cpu].lock, flags);
    4.61 -    res = detach_ac_timer(timer);	
    4.62 +    if (timer->timer_list.next)
    4.63 +        res = detach_ac_timer(timer);   
    4.64      spin_unlock_irqrestore(&ac_timers[cpu].lock, flags);
    4.65  
    4.66      return res;
    4.67 @@ -207,45 +192,23 @@ int mod_ac_timer(struct ac_timer *timer,
    4.68   */
    4.69  void do_ac_timer(void)
    4.70  {
    4.71 -    int 			 cpu = smp_processor_id();
    4.72 -    unsigned long 	 flags;
    4.73 -    struct ac_timer	 *t;
    4.74 +    int              cpu = smp_processor_id();
    4.75 +    unsigned long    flags;
    4.76 +    struct ac_timer  *t;
    4.77 +    s_time_t diff, now = NOW();
    4.78 +    long max;
    4.79  
    4.80      spin_lock_irqsave(&ac_timers[cpu].lock, flags);
    4.81  
    4.82   do_timer_again:
    4.83  
    4.84      TRC(printk("ACT  [%02d] do(): now=%lld\n", cpu, NOW()));
    4.85 -		
    4.86 -	/* Sanity: is the timer list empty? */
    4.87 -    if ( list_empty(&ac_timers[cpu].timers) )
    4.88 +        
    4.89 +    /* Sanity: is the timer list empty? */
    4.90 +    if ( list_empty(&ac_timers[cpu].timers) ) {
    4.91          printk("ACT[%02d] do_ac_timer(): timer irq without timer\n", cpu);
    4.92 -
    4.93 -#ifdef AC_TIMER_STATS
    4.94 -    {
    4.95 -        s32	diff;
    4.96 -        u32 i;
    4.97 -        diff = ((s32)(NOW() - t->expires)) / 1000; /* delta in us */
    4.98 -        if (diff < -BUCKETS)
    4.99 -            diff = -BUCKETS;
   4.100 -        else if (diff > BUCKETS)
   4.101 -            diff = BUCKETS;
   4.102 -        act_stats[cpu].times[diff+BUCKETS]++;
   4.103 -        act_stats[cpu].count++;
   4.104 -
   4.105 -        if (act_stats[cpu].count >= 5000) {
   4.106 -            printk("ACT Stats\n");
   4.107 -			for (i=0; i < 2*BUCKETS; i++) {
   4.108 -				if (act_stats[cpu].times[i] != 0)
   4.109 -                    printk("ACT [%02d]: %3dus: %5d\n",
   4.110 -                           cpu,i-BUCKETS, act_stats[cpu].times[i]);
   4.111 -                act_stats[cpu].times[i]=0;
   4.112 -            }
   4.113 -            act_stats[cpu].count = 0;
   4.114 -            printk("\n");
   4.115 -        }
   4.116 +        return;
   4.117      }
   4.118 -#endif
   4.119  
   4.120      /* Handle all timeouts in the near future. */
   4.121      while ( !list_empty(&ac_timers[cpu].timers) )
   4.122 @@ -253,12 +216,19 @@ void do_ac_timer(void)
   4.123          t = list_entry(ac_timers[cpu].timers.next, 
   4.124                         struct ac_timer, timer_list);
   4.125          if ( t->expires > (NOW() + TIMER_SLOP) ) break;
   4.126 +
   4.127 +        /* do some stats */
   4.128 +        diff = (now - t->expires);
   4.129 +        if (diff > 0x7fffffff) diff =  0x7fffffff; /* THIS IS BAD! */
   4.130 +        max = perfc_valuea(ac_timer_max, cpu);
   4.131 +        if (diff > max) perfc_seta(ac_timer_max, cpu, diff);
   4.132 +
   4.133          detach_ac_timer(t);
   4.134          spin_unlock_irqrestore(&ac_timers[cpu].lock, flags);
   4.135          if ( t->function != NULL ) t->function(t->data);
   4.136          spin_lock_irqsave(&ac_timers[cpu].lock, flags);
   4.137      }
   4.138 -		
   4.139 +        
   4.140      /* If list not empty then reprogram timer to new head of list */
   4.141      if ( !list_empty(&ac_timers[cpu].timers) )
   4.142      {
   4.143 @@ -287,7 +257,7 @@ static void dump_tqueue(struct list_head
   4.144  {
   4.145      struct list_head *list;
   4.146      int loop = 0;
   4.147 -    struct ac_timer	 *t;
   4.148 +    struct ac_timer  *t;
   4.149  
   4.150      printk ("QUEUE %s %lx   n: %lx, p: %lx\n", name,  (unsigned long)queue,
   4.151              (unsigned long) queue->next, (unsigned long) queue->prev);
   4.152 @@ -303,18 +273,21 @@ static void dump_tqueue(struct list_head
   4.153  }
   4.154  
   4.155  
   4.156 -static void dump_timerq(u_char key, void *dev_id, struct pt_regs *regs)
   4.157 +void dump_timerq(u_char key, void *dev_id, struct pt_regs *regs)
   4.158  {
   4.159      u_long   flags; 
   4.160      s_time_t now = NOW();
   4.161 +    int i;
   4.162  
   4.163 -    printk("Dumping ac_timer queues for cpu 0: NOW=0x%08X%08X\n",
   4.164 +    printk("Dumping ac_timer queues: NOW=0x%08X%08X\n",
   4.165             (u32)(now>>32), (u32)now); 
   4.166 -	
   4.167 -    spin_lock_irqsave(&ac_timers[0].lock, flags);
   4.168 -    dump_tqueue(&ac_timers[0].timers, "ac_time"); 
   4.169 -    spin_unlock_irqrestore(&ac_timers[0].lock, flags);
   4.170 -    printk("\n");
   4.171 +    for (i = 0; i < smp_num_cpus; i++) {
   4.172 +        printk("CPU[%02d] ", i);
   4.173 +        spin_lock_irqsave(&ac_timers[i].lock, flags);
   4.174 +        dump_tqueue(&ac_timers[i].timers, "ac_time"); 
   4.175 +        spin_unlock_irqrestore(&ac_timers[i].lock, flags);
   4.176 +        printk("\n");
   4.177 +    }
   4.178      return; 
   4.179  }
   4.180  
   4.181 @@ -330,6 +303,4 @@ void __init ac_timer_init(void)
   4.182          INIT_LIST_HEAD(&ac_timers[i].timers);
   4.183          spin_lock_init(&ac_timers[i].lock);
   4.184      }
   4.185 -
   4.186 -    add_key_handler('a', dump_timerq, "dump ac_timer queues");
   4.187  }
     5.1 --- a/xen/common/keyhandler.c	Wed Mar 12 16:44:57 2003 +0000
     5.2 +++ b/xen/common/keyhandler.c	Thu Mar 13 15:27:00 2003 +0000
     5.3 @@ -2,6 +2,7 @@
     5.4  #include <xeno/reboot.h>
     5.5  
     5.6  extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
     5.7 +extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs);
     5.8  
     5.9  #define KEY_MAX 256
    5.10  #define STR_MAX  64
    5.11 @@ -122,6 +123,7 @@ void initialize_keytable()
    5.12      add_key_handler('d', dump_registers, "dump registers"); 
    5.13      add_key_handler('h', show_handlers, "show this message");
    5.14      add_key_handler('p', perfc_printall, "print performance counters"); 
    5.15 +    add_key_handler('P', perfc_reset,    "reset performance counters"); 
    5.16      add_key_handler('q', do_task_queues, "dump task queues + guest state");
    5.17      add_key_handler('R', halt_machine, "reboot machine ungracefully"); 
    5.18      
     6.1 --- a/xen/common/perfc.c	Wed Mar 12 16:44:57 2003 +0000
     6.2 +++ b/xen/common/perfc.c	Thu Mar 13 15:27:00 2003 +0000
     6.3 @@ -2,12 +2,19 @@
     6.4   * xen performance counters
     6.5   */
     6.6  
     6.7 +#include <xeno/lib.h>
     6.8 +#include <xeno/smp.h>
     6.9 +#include <xeno/time.h>
    6.10  #include <xeno/perfc.h>
    6.11  #include <xeno/keyhandler.h> 
    6.12  
    6.13 -#undef  PERFCOUNTER
    6.14 -#undef  PERFCOUNTER_ARRAY
    6.15 +/* used for different purposes in perfc.h and here */
    6.16 +#undef PERFCOUNTER
    6.17 +#undef PERFCOUNTER_CPU
    6.18 +#undef PERFCOUNTER_ARRAY
    6.19 +
    6.20  #define PERFCOUNTER( var, name ) "[0]"name"\0",
    6.21 +#define PERFCOUNTER_CPU( var, name )  "C"name"\0",
    6.22  #define PERFCOUNTER_ARRAY( var, name, size )  "["#size"]"name"\0",
    6.23  
    6.24  char* perfc_name[] = {
    6.25 @@ -21,63 +28,89 @@ void __perfc_print (unsigned long counte
    6.26    int loop;
    6.27    int total_size = 0;
    6.28    int element_size = 0;
    6.29 +  int cpus = 0;
    6.30    int num = 0;
    6.31  
    6.32 -  for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++)
    6.33 -  {
    6.34 -    num = sscanf (perfc_name[loop], "[%d]", &element_size);
    6.35 -    total_size += element_size == 0 ? 1 : element_size;
    6.36 -    if (total_size > offset) break;
    6.37 +  for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
    6.38 +      if (perfc_name[loop][0] == 'C') {
    6.39 +          element_size = NR_CPUS;
    6.40 +          cpus = 1;
    6.41 +      } else {
    6.42 +          num = sscanf (perfc_name[loop], "[%d]", &element_size);
    6.43 +      }
    6.44 +
    6.45 +      total_size += element_size == 0 ? 1 : element_size;
    6.46 +      if (total_size > offset) break;
    6.47    }
    6.48 -  if (loop == sizeof(perfc_name) / sizeof(char *))
    6.49 -  {
    6.50 -    printf ("error: couldn't find variable\n"); 
    6.51 -    return;
    6.52 +  if (loop == sizeof(perfc_name) / sizeof(char *)) {
    6.53 +      printf ("error: couldn't find variable\n"); 
    6.54 +      return;
    6.55    }
    6.56 -  if (element_size == 0)                                   /* single counter */
    6.57 -  {
    6.58 -    printf ("%10ld  0x%08lx  %s\n", counter[0], counter[0],
    6.59 -	    perfc_name[loop] + 2 + num);
    6.60 -  }
    6.61 -  else                                                  /* show entire array */
    6.62 -  {
    6.63 -    for (loop = 0; loop < element_size; loop++)
    6.64 -    {
    6.65 -      printf ("%10ld  0x%08lx  %s:%d\n", 
    6.66 -	      counter[loop], counter[loop], 
    6.67 -	      perfc_name[loop] + 2 + num, loop);
    6.68 -    }
    6.69 +  if (element_size == 0) {                              /* single counter */
    6.70 +      printf ("%10ld  0x%08lx  %s\n", counter[0], counter[0],
    6.71 +              perfc_name[loop] + 2 + num);
    6.72 +  } else if (cpus) {                                    /* counter per CPU  */
    6.73 +      for (loop = 0; loop < smp_num_cpus; loop++) {
    6.74 +          printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
    6.75 +                  counter[loop], counter[loop], 
    6.76 +                  loop, perfc_name[loop]);
    6.77 +      }
    6.78 +      
    6.79 +  } else {                                             /* show entire array */
    6.80 +      for (loop = 0; loop < element_size; loop++) {
    6.81 +          printf ("%10ld  0x%08lx  %s:%d\n", 
    6.82 +                  counter[loop], counter[loop], 
    6.83 +                  perfc_name[loop] + 2 + num, loop);
    6.84 +      }
    6.85    }
    6.86    return;
    6.87  }
    6.88  
    6.89  void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs)
    6.90  {
    6.91 -  int loop, idx;
    6.92 -  int element_size;
    6.93 -  int num;
    6.94 -  unsigned long *counters = (unsigned long *)&perfcounters;
    6.95 +    int loop, idx;
    6.96 +    int element_size;
    6.97 +    int cpus=0;
    6.98 +    int num = 0;
    6.99 +    s_time_t now = NOW();
   6.100 +    unsigned long *counters = (unsigned long *)&perfcounters;
   6.101  
   6.102 -  printf ("xen performance counters\n");
   6.103 -  for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++)
   6.104 -  {
   6.105 -    num = sscanf (perfc_name[loop], "[%d]", &element_size);
   6.106 +    printf ("xen performance counters: now=0x%08X%08X\n",
   6.107 +            (u32)(now>>32), (u32)now);
   6.108 +
   6.109 +    for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
   6.110 +
   6.111 +        if (perfc_name[loop][0] == 'C') {
   6.112 +            element_size = NR_CPUS;
   6.113 +            cpus = 1;
   6.114 +        } else {
   6.115 +            num = sscanf (perfc_name[loop], "[%d]", &element_size);
   6.116 +        }
   6.117      
   6.118 -    for (idx = 0; idx < (element_size ? element_size : 1); idx++)
   6.119 -    {
   6.120 -      if (element_size)
   6.121 -      {
   6.122 -	printf ("%10ld  0x%08lx  %s:%d\n", 
   6.123 -		*counters, *counters, perfc_name[loop] + num + 2, idx);
   6.124 -      }
   6.125 -      else
   6.126 -      {
   6.127 -	printf ("%10ld  0x%08lx  %s\n", 
   6.128 -		*counters, *counters, perfc_name[loop] + num + 2);
   6.129 -      }
   6.130 -      counters++;
   6.131 +        for (idx = 0; idx < (element_size ? element_size : 1); idx++) {
   6.132 +            if (cpus) {
   6.133 +                if (idx < smp_num_cpus)
   6.134 +                    printf ("%10ld  0x%08lx  cpu[%02d] %s\n", 
   6.135 +                            *counters, *counters, idx, perfc_name[loop] + 1);
   6.136 +            } else if (element_size) {
   6.137 +                printf ("%10ld  0x%08lx  %s:%d\n", 
   6.138 +                        *counters, *counters, perfc_name[loop] + num + 2, idx);
   6.139 +            } else {
   6.140 +                printf ("%10ld  0x%08lx  %s\n", 
   6.141 +                        *counters, *counters, perfc_name[loop] + num + 2);
   6.142 +            }
   6.143 +            counters++;
   6.144 +        }
   6.145      }
   6.146 -  }
   6.147 +
   6.148 +    return;
   6.149 +}
   6.150  
   6.151 -  return;
   6.152 +void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs)
   6.153 +{
   6.154 +    s_time_t now = NOW();
   6.155 +    printk ("xen performance counters reset: now=0x%08X%08X\n",
   6.156 +            (u32)(now>>32), (u32)now);
   6.157 +    memset (&perfcounters, 0, sizeof(perfcounters));
   6.158  }
   6.159 +
     7.1 --- a/xen/include/xeno/perfc.h	Wed Mar 12 16:44:57 2003 +0000
     7.2 +++ b/xen/include/xeno/perfc.h	Thu Mar 13 15:27:00 2003 +0000
     7.3 @@ -3,22 +3,31 @@
     7.4   */
     7.5  
     7.6  /* 
     7.7 - * NOTE: new counters must be defined in xen_perf_defn.h
     7.8 + * NOTE: new counters must be defined in perfc_defn.h
     7.9   * 
    7.10   * PERFCOUNTER (counter, string)              define a new performance counter
    7.11 + * PERFCOUNTER_CPU (counter, string, size)    define a counter per CPU
    7.12   * PERFCOUNTER_ARRY (counter, string, size)   define an array of counters
    7.13   * 
    7.14   * unsigned long perfc_value  (counter)        get value of a counter  
    7.15 + * unsigned long perfc_valuec (counter)        get value of a per CPU counter
    7.16   * unsigned long perfc_valuea (counter, index) get value of an array counter
    7.17 - * void perfc_incr   (counter)                 increment a counter          
    7.18 - * void perfc_incra  (counter, index)          increment an array counter   
    7.19 - * void perfc_add    (counter, value)          add a value to a counter     
    7.20 - * void perfc_adda   (counter, index, value)   add a value to array counter 
    7.21 - * void perfc_print  (counter)                 print out the counter
    7.22 + * unsigned long perfc_set  (counter, val)     set value of a counter  
    7.23 + * unsigned long perfc_setc (counter, val)     set value of a per CPU counter
    7.24 + * unsigned long perfc_seta (counter, index, val) set value of an array counter
    7.25 + * void perfc_incr  (counter)                  increment a counter          
    7.26 + * void perfc_incrc (counter, index)           increment a per CPU counter   
    7.27 + * void perfc_incra (counter, index)           increment an array counter   
    7.28 + * void perfc_add   (counter, value)           add a value to a counter     
    7.29 + * void perfc_addc  (counter, value)           add a value to a per CPU counter
    7.30 + * void perfc_adda  (counter, index, value)    add a value to array counter 
    7.31 + * void perfc_print (counter)                  print out the counter
    7.32   */
    7.33  
    7.34  #define PERFCOUNTER( var, name ) \
    7.35  unsigned long var[1];
    7.36 +#define PERFCOUNTER_CPU( var, name ) \
    7.37 +unsigned long var[NR_CPUS];
    7.38  #define PERFCOUNTER_ARRAY( var, name, size ) \
    7.39  unsigned long var[size];
    7.40  
    7.41 @@ -30,12 +39,18 @@ struct perfcounter_t
    7.42  extern struct perfcounter_t perfcounters;
    7.43  extern char *perfc_name[];
    7.44  
    7.45 -#define perf_value(x)    perfcounters.x[0]
    7.46 -#define perf_valuea(x,y) perfcounters.x[y]
    7.47 -#define perf_incr(x)     perfcounters.x[0]++
    7.48 -#define perf_incra(x,y)  perfcounters.x[y]++
    7.49 -#define perf_add(x,y)    perfcounters.x[0]+=(y)
    7.50 -#define perf_adda(x,y,z) perfcounters.x[y]+=(z)
    7.51 +#define perfc_value(x)    perfcounters.x[0]
    7.52 +#define perfc_valuec(x)   perfcounters.x[smp_processor_id()]
    7.53 +#define perfc_valuea(x,y) perfcounters.x[y]
    7.54 +#define perfc_set(x,v)    perfcounters.x[0] = v
    7.55 +#define perfc_setc(x,v)   perfcounters.x[smp_processor_id()] = v
    7.56 +#define perfc_seta(x,y,v) perfcounters.x[y] = v
    7.57 +#define perfc_incr(x)     perfcounters.x[0]++
    7.58 +#define perfc_incrc(x)    perfcounters.x[smp_processor_id()]++
    7.59 +#define perfc_incra(x,y)  perfcounters.x[y]++
    7.60 +#define perfc_add(x,y)    perfcounters.x[0]+=(y)
    7.61 +#define perfc_addc(x,y)   perfcounters.x[smp_processor_id()]+=(y)
    7.62 +#define perfc_adda(x,y,z) perfcounters.x[y]+=(z)
    7.63  
    7.64  #define perf_print(x) \
    7.65    __perfc_print(perfcounters.x, \
     8.1 --- a/xen/include/xeno/perfc_defn.h	Wed Mar 12 16:44:57 2003 +0000
     8.2 +++ b/xen/include/xeno/perfc_defn.h	Thu Mar 13 15:27:00 2003 +0000
     8.3 @@ -1,4 +1,10 @@
     8.4 +
     8.5 +PERFCOUNTER_CPU( irqs,         "#interrupts" )
     8.6 +PERFCOUNTER_CPU( irq_time,     "cycles spent in irq handler" )
     8.7  
     8.8  PERFCOUNTER( blockio_tx, "block io: messages received from tx queue" )
     8.9  PERFCOUNTER( blockio_rx, "block io: messages sent on rx queue" )
    8.10  
    8.11 +PERFCOUNTER_CPU( apic_timer,    "apic timer interrupts" )
    8.12 +PERFCOUNTER_CPU( ac_timer_max,  "ac_timer max error" )
    8.13 +