ia64/xen-unstable

changeset 664:8772d7598f1e

bitkeeper revision 1.379 (3f27c63d0n0AK0DFCerOSUf9Wi3atA)

dev.c, perfc_defn.h, perfc.h, perfc.c:
Added perfctrs to net rx path.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jul 30 13:21:01 2003 +0000 (2003-07-30)
parents 355a3d7a2a84
children 63045128dbbb
files xen/common/perfc.c xen/include/xeno/perfc.h xen/include/xeno/perfc_defn.h xen/net/dev.c
line diff
     1.1 --- a/xen/common/perfc.c	Wed Jul 30 13:06:06 2003 +0000
     1.2 +++ b/xen/common/perfc.c	Wed Jul 30 13:21:01 2003 +0000
     1.3 @@ -27,7 +27,7 @@ void perfc_printall(u_char key, void *de
     1.4  {
     1.5      int i, j;
     1.6      s_time_t now = NOW();
     1.7 -    unsigned long *counters = (unsigned long *)&perfcounters;
     1.8 +    atomic_t *counters = (atomic_t *)&perfcounters;
     1.9  
    1.10      printk("Xen performance counters SHOW  (now = 0x%08X:%08X)\n",
    1.11             (u32)(now>>32), (u32)now);
    1.12 @@ -37,20 +37,23 @@ void perfc_printall(u_char key, void *de
    1.13          switch ( perfc_info[i].type )
    1.14          {
    1.15          case TYPE_SINGLE:
    1.16 -            printk("%10ld  0x%08lx  %s\n", 
    1.17 -                   counters[0], counters[0], perfc_info[i].name);
    1.18 +            printk("%10d  0x%08x  %s\n", 
    1.19 +                   atomic_read(&counters[0]), atomic_read(&counters[0]), 
    1.20 +                   perfc_info[i].name);
    1.21              counters += 1;
    1.22              break;
    1.23          case TYPE_CPU:
    1.24              for ( j = 0; j < smp_num_cpus; j++ )
    1.25 -                printk("%10ld  0x%08lx  %s[CPU %02d]\n",
    1.26 -                       counters[j], counters[j], perfc_info[i].name, j);
    1.27 +                printk("%10d  0x%08x  %s[CPU %02d]\n",
    1.28 +                       atomic_read(&counters[j]), atomic_read(&counters[j]), 
    1.29 +                       perfc_info[i].name, j);
    1.30              counters += j;
    1.31              break;
    1.32          case TYPE_ARRAY:
    1.33              for ( j = 0; j < perfc_info[i].nr_elements; j++ )
    1.34 -                printk("%10ld  0x%08lx  %s[ARR %02d]\n",
    1.35 -                       counters[j], counters[j], perfc_info[i].name, j);
    1.36 +                printk("%10d  0x%08x  %s[ARR %02d]\n",
    1.37 +                       atomic_read(&counters[j]), atomic_read(&counters[j]), 
    1.38 +                       perfc_info[i].name, j);
    1.39              counters += j;
    1.40              break;
    1.41          }
     2.1 --- a/xen/include/xeno/perfc.h	Wed Jul 30 13:06:06 2003 +0000
     2.2 +++ b/xen/include/xeno/perfc.h	Wed Jul 30 13:21:01 2003 +0000
     2.3 @@ -2,6 +2,8 @@
     2.4   * xen performance counters
     2.5   */
     2.6  
     2.7 +#include <asm/atomic.h>
     2.8 +
     2.9  /* 
    2.10   * NOTE: new counters must be defined in perfc_defn.h
    2.11   * 
    2.12 @@ -25,11 +27,11 @@
    2.13   */
    2.14  
    2.15  #define PERFCOUNTER( var, name ) \
    2.16 -unsigned long var[1];
    2.17 +  atomic_t var[1];
    2.18  #define PERFCOUNTER_CPU( var, name ) \
    2.19 -unsigned long var[NR_CPUS];
    2.20 +  atomic_t var[NR_CPUS];
    2.21  #define PERFCOUNTER_ARRAY( var, name, size ) \
    2.22 -unsigned long var[size];
    2.23 +  atomic_t var[size];
    2.24  
    2.25  struct perfcounter_t 
    2.26  {
    2.27 @@ -38,16 +40,16 @@ struct perfcounter_t
    2.28  
    2.29  extern struct perfcounter_t perfcounters;
    2.30  
    2.31 -#define perfc_value(x)    perfcounters.x[0]
    2.32 -#define perfc_valuec(x)   perfcounters.x[smp_processor_id()]
    2.33 -#define perfc_valuea(x,y) perfcounters.x[y]
    2.34 -#define perfc_set(x,v)    perfcounters.x[0] = v
    2.35 -#define perfc_setc(x,v)   perfcounters.x[smp_processor_id()] = v
    2.36 -#define perfc_seta(x,y,v) perfcounters.x[y] = v
    2.37 -#define perfc_incr(x)     perfcounters.x[0]++
    2.38 -#define perfc_incrc(x)    perfcounters.x[smp_processor_id()]++
    2.39 -#define perfc_incra(x,y)  perfcounters.x[y]++
    2.40 -#define perfc_add(x,y)    perfcounters.x[0]+=(y)
    2.41 -#define perfc_addc(x,y)   perfcounters.x[smp_processor_id()]+=(y)
    2.42 -#define perfc_adda(x,y,z) perfcounters.x[y]+=(z)
    2.43 +#define perfc_value(x)    atomic_read(&perfcounters.x[0])
    2.44 +#define perfc_valuec(x)   atomic_read(&perfcounters.x[smp_processor_id()])
    2.45 +#define perfc_valuea(x,y) atomic_read(&perfcounters.x[y])
    2.46 +#define perfc_set(x,v)    atomic_set(&perfcounters.x[0], v)
    2.47 +#define perfc_setc(x,v)   atomic_set(&perfcounters.x[smp_processor_id()], v)
    2.48 +#define perfc_seta(x,y,v) atomic_set(&perfcounters.x[y], v)
    2.49 +#define perfc_incr(x)     atomic_inc(&perfcounters.x[0])
    2.50 +#define perfc_incrc(x)    atomic_inc(&perfcounters.x[smp_processor_id()])
    2.51 +#define perfc_incra(x,y)  atomic_inc(&perfcounters.x[y])
    2.52 +#define perfc_add(x,y)    atomic_add((y), &perfcounters.x[0])
    2.53 +#define perfc_addc(x,y)   atomic_add((y), &perfcounters.x[smp_processor_id()])
    2.54 +#define perfc_adda(x,y,z) atomic_add((z), &perfcounters.x[y])
    2.55  
     3.1 --- a/xen/include/xeno/perfc_defn.h	Wed Jul 30 13:06:06 2003 +0000
     3.2 +++ b/xen/include/xeno/perfc_defn.h	Wed Jul 30 13:21:01 2003 +0000
     3.3 @@ -9,3 +9,6 @@ PERFCOUNTER_CPU( sched_run1,   "sched: c
     3.4  PERFCOUNTER_CPU( sched_run2,   "sched: runs through scheduler" )
     3.5  PERFCOUNTER_CPU( sched_ctx,    "sched: context switches" )
     3.6  
     3.7 +PERFCOUNTER( net_rx_capacity_drop, "net rx capacity drop" )
     3.8 +PERFCOUNTER( net_rx_delivered, "net rx delivered" )
     3.9 +PERFCOUNTER( net_rx_tlbflush, "net rx tlb flushes" )
     4.1 --- a/xen/net/dev.c	Wed Jul 30 13:06:06 2003 +0000
     4.2 +++ b/xen/net/dev.c	Wed Jul 30 13:21:01 2003 +0000
     4.3 @@ -32,6 +32,8 @@
     4.4  #include <asm/domain_page.h>
     4.5  #include <asm/pgalloc.h>
     4.6  
     4.7 +#include <xeno/perfc.h>
     4.8 +
     4.9  #define BUG_TRAP ASSERT
    4.10  #define notifier_call_chain(_a,_b,_c) ((void)0)
    4.11  #define rtmsg_ifinfo(_a,_b,_c) ((void)0)
    4.12 @@ -514,6 +516,7 @@ void deliver_packet(struct sk_buff *skb,
    4.13      if ( (i = vif->rx_cons) == vif->rx_prod )
    4.14      {
    4.15          spin_unlock(&vif->domain->page_lock);
    4.16 +        perfc_incr(net_rx_capacity_drop);
    4.17          return;
    4.18      }
    4.19      rx = vif->rx_shadow_ring + i;
    4.20 @@ -570,14 +573,19 @@ void deliver_packet(struct sk_buff *skb,
    4.21       */
    4.22      if ( rx->flush_count == (unsigned short)
    4.23           atomic_read(&tlb_flush_count[vif->domain->processor]) )
    4.24 +    {
    4.25 +        perfc_incr(net_rx_tlbflush);
    4.26          flush_tlb_cpu(vif->domain->processor);
    4.27 +    }
    4.28  
    4.29 - out:
    4.30 -    make_rx_response(vif, rx->id, size, status, offset);
    4.31 +    perfc_incr(net_rx_delivered);
    4.32  
    4.33      /* record this so they can be billed */
    4.34      vif->total_packets_received++;
    4.35      vif->total_bytes_received += size;
    4.36 +
    4.37 + out:
    4.38 +    make_rx_response(vif, rx->id, size, status, offset);
    4.39  }
    4.40  
    4.41  /**