WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] add perfcounters for pagetable update histograms

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] add perfcounters for pagetable update histograms
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 22 Feb 2005 18:44:00 +0000
Delivery-date: Tue, 05 Apr 2005 16:04:41 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1230.4.1, 2005/02/22 18:44:00+00:00, 
rneugeba@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

        add perfcounters for pagetable update histograms
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 arch/x86/mm.c            |   52 ++++++++++++++++++++++++++++++++++++++++++++++-
 common/perfc.c           |    8 +++++--
 include/xen/perfc_defn.h |   11 ++++++++-
 3 files changed, 66 insertions(+), 5 deletions(-)


diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-04-05 12:04:44 -04:00
+++ b/xen/arch/x86/mm.c 2005-04-05 12:04:44 -04:00
@@ -1686,8 +1686,30 @@
         }
     }
 
+#ifdef PERF_COUNTERS
     perfc_incrc(calls_to_mmu_update); 
     perfc_addc(num_page_updates, count);
+    /*
+     * do a histogram for count. 
+     * first bucket is for count=0,
+     * second bucket is for count=1
+     * last bucket is for count >= 63 *  PERFC_PT_UPDATES_BUCKET_SIZE
+     */
+    if ( count == 0 )
+    {
+        perfc_incra(bpt_updates, 0);
+    } else if ( count == 1 )
+    {
+        perfc_incra(bpt_updates, 1);
+    } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE)
+                < (PERFC_MAX_PT_UPDATES - 3) )
+    {
+        perfc_incra(bpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2);
+    } else
+    {
+        perfc_incra(bpt_updates, PERFC_MAX_PT_UPDATES - 1);
+    }
+#endif
 
     if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
     {
@@ -2232,6 +2254,7 @@
     int            i, cpu = smp_processor_id();
     struct exec_domain *ed = current;
     struct domain *d = ed->domain;
+    unsigned int   count;
 
     l1va = ptwr_info[cpu].ptinfo[which].l1va;
     ptep = (unsigned long *)&linear_pg_table[l1_linear_offset(l1va)];
@@ -2290,7 +2313,7 @@
     /*
      * STEP 2. Validate any modified PTEs.
      */
-
+    count = 0;
     pl1e = ptwr_info[cpu].ptinfo[which].pl1e;
     for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
     {
@@ -2300,6 +2323,9 @@
         if ( likely(l1_pgentry_val(ol1e) == l1_pgentry_val(nl1e)) )
             continue;
 
+        /* update number of entries modified */
+        count++;
+
         /*
          * Fast path for PTEs that have merely been write-protected
          * (e.g., during a Unix fork()). A strict reduction in privilege.
@@ -2340,6 +2366,30 @@
             put_page_from_l1e(ol1e, d);
     }
     unmap_domain_mem(pl1e);
+
+#ifdef PERF_COUNTERS
+    /*
+     * do a histogram for count. 
+     * first bucket is for count=0,
+     * second bucket is for count=1
+     * last bucket is for count >= 63 *  PERFC_PT_UPDATES_BUCKET_SIZE
+     */
+    if ( count == 0 )
+    {
+        perfc_incra(wpt_updates, 0);
+    } else if ( count == 1 ) 
+    {
+        perfc_incra(wpt_updates, 1);
+    } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE)
+                < (PERFC_MAX_PT_UPDATES - 3) )
+    {
+        perfc_incra(wpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2);
+    } else
+    {
+        perfc_incra(wpt_updates, PERFC_MAX_PT_UPDATES - 1);
+    }
+#endif
+    
 
     /*
      * STEP 3. Reattach the L1 p.t. page into the current address space.
diff -Nru a/xen/common/perfc.c b/xen/common/perfc.c
--- a/xen/common/perfc.c        2005-04-05 12:04:44 -04:00
+++ b/xen/common/perfc.c        2005-04-05 12:04:44 -04:00
@@ -66,9 +66,13 @@
         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[%10d]\n ", sum);
             for ( j = 0; j < perfc_info[i].nr_elements; j++ )
-                printk("ARR%02d[%10d]  ", j, atomic_read(&counters[j]));
+            {
+                printk("A%02d[%10d]  ", j, atomic_read(&counters[j]));
+                if ( !(j % 4) )
+                    printk("\n ");
+            }
             counters += j;
             break;
         }
diff -Nru a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h
--- a/xen/include/xen/perfc_defn.h      2005-04-05 12:04:44 -04:00
+++ b/xen/include/xen/perfc_defn.h      2005-04-05 12:04:44 -04:00
@@ -35,7 +35,14 @@
 PERFCOUNTER_CPU( check_pagetable, "calls to check_pagetable" )
 PERFCOUNTER_CPU( check_all_pagetables, "calls to check_all_pagetables" )
 
+/* XXX constant from dom0_ops.h */
+#define PERFC_MAX_PT_UPDATES 64
+#define PERFC_PT_UPDATES_BUCKET_SIZE 3
+PERFCOUNTER_ARRAY( wpt_updates, "writable pt updates", PERFC_MAX_PT_UPDATES )
+PERFCOUNTER_ARRAY( bpt_updates, "batched pt updates", PERFC_MAX_PT_UPDATES )
+
+
 #define VMX_PERF_EXIT_REASON_SIZE 37
 #define VMX_PERF_VECTOR_SIZE 0x20
-PERFCOUNTER_ARRAY(vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE )
-PERFCOUNTER_ARRAY(cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE )
+PERFCOUNTER_ARRAY( vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE )
+PERFCOUNTER_ARRAY( cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE )

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] add perfcounters for pagetable update histograms, BitKeeper Bot <=