ia64/xen-unstable
changeset 3894:ba1a314ce815
bitkeeper revision 1.1230.4.1 (421b7d70g_kPPMvAgkUMMU-R8G4RrA)
add perfcounters for pagetable update histograms
Signed-off-by: michael.fetterman@cl.cam.ac.uk
add perfcounters for pagetable update histograms
Signed-off-by: michael.fetterman@cl.cam.ac.uk
author | rneugeba@wyvis.research.intel-research.net |
---|---|
date | Tue Feb 22 18:44:00 2005 +0000 (2005-02-22) |
parents | 21d06c9e4db5 |
children | b57a97bb65bd |
files | xen/arch/x86/mm.c xen/common/perfc.c xen/include/xen/perfc_defn.h |
line diff
1.1 --- a/xen/arch/x86/mm.c Mon Feb 21 11:31:57 2005 +0000 1.2 +++ b/xen/arch/x86/mm.c Tue Feb 22 18:44:00 2005 +0000 1.3 @@ -1686,8 +1686,30 @@ int do_mmu_update( 1.4 } 1.5 } 1.6 1.7 +#ifdef PERF_COUNTERS 1.8 perfc_incrc(calls_to_mmu_update); 1.9 perfc_addc(num_page_updates, count); 1.10 + /* 1.11 + * do a histogram for count. 1.12 + * first bucket is for count=0, 1.13 + * second bucket is for count=1 1.14 + * last bucket is for count >= 63 * PERFC_PT_UPDATES_BUCKET_SIZE 1.15 + */ 1.16 + if ( count == 0 ) 1.17 + { 1.18 + perfc_incra(bpt_updates, 0); 1.19 + } else if ( count == 1 ) 1.20 + { 1.21 + perfc_incra(bpt_updates, 1); 1.22 + } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE) 1.23 + < (PERFC_MAX_PT_UPDATES - 3) ) 1.24 + { 1.25 + perfc_incra(bpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2); 1.26 + } else 1.27 + { 1.28 + perfc_incra(bpt_updates, PERFC_MAX_PT_UPDATES - 1); 1.29 + } 1.30 +#endif 1.31 1.32 if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) ) 1.33 { 1.34 @@ -2232,6 +2254,7 @@ void ptwr_flush(const int which) 1.35 int i, cpu = smp_processor_id(); 1.36 struct exec_domain *ed = current; 1.37 struct domain *d = ed->domain; 1.38 + unsigned int count; 1.39 1.40 l1va = ptwr_info[cpu].ptinfo[which].l1va; 1.41 ptep = (unsigned long *)&linear_pg_table[l1_linear_offset(l1va)]; 1.42 @@ -2290,7 +2313,7 @@ void ptwr_flush(const int which) 1.43 /* 1.44 * STEP 2. Validate any modified PTEs. 1.45 */ 1.46 - 1.47 + count = 0; 1.48 pl1e = ptwr_info[cpu].ptinfo[which].pl1e; 1.49 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) 1.50 { 1.51 @@ -2300,6 +2323,9 @@ void ptwr_flush(const int which) 1.52 if ( likely(l1_pgentry_val(ol1e) == l1_pgentry_val(nl1e)) ) 1.53 continue; 1.54 1.55 + /* update number of entries modified */ 1.56 + count++; 1.57 + 1.58 /* 1.59 * Fast path for PTEs that have merely been write-protected 1.60 * (e.g., during a Unix fork()). A strict reduction in privilege. 1.61 @@ -2341,6 +2367,30 @@ void ptwr_flush(const int which) 1.62 } 1.63 unmap_domain_mem(pl1e); 1.64 1.65 +#ifdef PERF_COUNTERS 1.66 + /* 1.67 + * do a histogram for count. 1.68 + * first bucket is for count=0, 1.69 + * second bucket is for count=1 1.70 + * last bucket is for count >= 63 * PERFC_PT_UPDATES_BUCKET_SIZE 1.71 + */ 1.72 + if ( count == 0 ) 1.73 + { 1.74 + perfc_incra(wpt_updates, 0); 1.75 + } else if ( count == 1 ) 1.76 + { 1.77 + perfc_incra(wpt_updates, 1); 1.78 + } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE) 1.79 + < (PERFC_MAX_PT_UPDATES - 3) ) 1.80 + { 1.81 + perfc_incra(wpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2); 1.82 + } else 1.83 + { 1.84 + perfc_incra(wpt_updates, PERFC_MAX_PT_UPDATES - 1); 1.85 + } 1.86 +#endif 1.87 + 1.88 + 1.89 /* 1.90 * STEP 3. Reattach the L1 p.t. page into the current address space. 1.91 */
2.1 --- a/xen/common/perfc.c Mon Feb 21 11:31:57 2005 +0000 2.2 +++ b/xen/common/perfc.c Tue Feb 22 18:44:00 2005 +0000 2.3 @@ -66,9 +66,13 @@ void perfc_printall(unsigned char key) 2.4 case TYPE_S_ARRAY: 2.5 for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ ) 2.6 sum += atomic_read(&counters[j]); 2.7 - printk("TOTAL[%10d] ", sum); 2.8 + printk("TOTAL[%10d]\n ", sum); 2.9 for ( j = 0; j < perfc_info[i].nr_elements; j++ ) 2.10 - printk("ARR%02d[%10d] ", j, atomic_read(&counters[j])); 2.11 + { 2.12 + printk("A%02d[%10d] ", j, atomic_read(&counters[j])); 2.13 + if ( !(j % 4) ) 2.14 + printk("\n "); 2.15 + } 2.16 counters += j; 2.17 break; 2.18 }
3.1 --- a/xen/include/xen/perfc_defn.h Mon Feb 21 11:31:57 2005 +0000 3.2 +++ b/xen/include/xen/perfc_defn.h Tue Feb 22 18:44:00 2005 +0000 3.3 @@ -35,7 +35,14 @@ PERFSTATUS( shadow_l1_pages, "current # 3.4 PERFCOUNTER_CPU( check_pagetable, "calls to check_pagetable" ) 3.5 PERFCOUNTER_CPU( check_all_pagetables, "calls to check_all_pagetables" ) 3.6 3.7 +/* XXX constant from dom0_ops.h */ 3.8 +#define PERFC_MAX_PT_UPDATES 64 3.9 +#define PERFC_PT_UPDATES_BUCKET_SIZE 3 3.10 +PERFCOUNTER_ARRAY( wpt_updates, "writable pt updates", PERFC_MAX_PT_UPDATES ) 3.11 +PERFCOUNTER_ARRAY( bpt_updates, "batched pt updates", PERFC_MAX_PT_UPDATES ) 3.12 + 3.13 + 3.14 #define VMX_PERF_EXIT_REASON_SIZE 37 3.15 #define VMX_PERF_VECTOR_SIZE 0x20 3.16 -PERFCOUNTER_ARRAY(vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE ) 3.17 -PERFCOUNTER_ARRAY(cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE ) 3.18 +PERFCOUNTER_ARRAY( vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE ) 3.19 +PERFCOUNTER_ARRAY( cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE )