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] [xen-unstable] scheduler: Use perf_counter subsystem for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] scheduler: Use perf_counter subsystem for stats
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Mar 2009 04:30:21 -0700
Delivery-date: Mon, 09 Mar 2009 04:31:37 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236594744 0
# Node ID b249f3e979a5152c7fda4b1037846d75982b726d
# Parent  f57ac4af36b431b10645ee145270ee658f46d58d
scheduler: Use perf_counter subsystem for stats

Signed-off-by: Xiaowei Yang <xiaowei.yang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/sched_credit.c    |   93 ++-----------------------------------------
 xen/include/xen/perfc_defn.h |   34 +++++++++++++++
 2 files changed, 39 insertions(+), 88 deletions(-)

diff -r f57ac4af36b4 -r b249f3e979a5 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Mon Mar 09 09:56:16 2009 +0000
+++ b/xen/common/sched_credit.c Mon Mar 09 10:32:24 2009 +0000
@@ -25,12 +25,14 @@
 /*
  * CSCHED_STATS
  *
- * Manage very basic counters and stats.
+ * Manage very basic per-vCPU counters and stats.
  *
  * Useful for debugging live systems. The stats are displayed
  * with runq dumps ('r' on the Xen console).
  */
+#ifdef PERF_COUNTERS
 #define CSCHED_STATS
+#endif
 
 
 /*
@@ -77,86 +79,9 @@
 /*
  * Stats
  */
+#define CSCHED_STAT_CRANK(_X)               (perfc_incr(_X))
+
 #ifdef CSCHED_STATS
-
-#define CSCHED_STAT(_X)         (csched_priv.stats._X)
-#define CSCHED_STAT_DEFINE(_X)  uint32_t _X;
-#define CSCHED_STAT_PRINTK(_X)                                  \
-    do                                                          \
-    {                                                           \
-        printk("\t%-30s = %u\n", #_X, CSCHED_STAT(_X));  \
-    } while ( 0 );
-
-/*
- * Try and keep often cranked stats on top so they'll fit on one
- * cache line.
- */
-#define CSCHED_STATS_EXPAND_SCHED(_MACRO)   \
-    _MACRO(schedule)                        \
-    _MACRO(acct_run)                        \
-    _MACRO(acct_no_work)                    \
-    _MACRO(acct_balance)                    \
-    _MACRO(acct_reorder)                    \
-    _MACRO(acct_min_credit)                 \
-    _MACRO(acct_vcpu_active)                \
-    _MACRO(acct_vcpu_idle)                  \
-    _MACRO(vcpu_sleep)                      \
-    _MACRO(vcpu_wake_running)               \
-    _MACRO(vcpu_wake_onrunq)                \
-    _MACRO(vcpu_wake_runnable)              \
-    _MACRO(vcpu_wake_not_runnable)          \
-    _MACRO(vcpu_park)                       \
-    _MACRO(vcpu_unpark)                     \
-    _MACRO(tickle_local_idler)              \
-    _MACRO(tickle_local_over)               \
-    _MACRO(tickle_local_under)              \
-    _MACRO(tickle_local_other)              \
-    _MACRO(tickle_idlers_none)              \
-    _MACRO(tickle_idlers_some)              \
-    _MACRO(load_balance_idle)               \
-    _MACRO(load_balance_over)               \
-    _MACRO(load_balance_other)              \
-    _MACRO(steal_trylock_failed)            \
-    _MACRO(steal_peer_idle)                 \
-    _MACRO(migrate_queued)                  \
-    _MACRO(migrate_running)                 \
-    _MACRO(dom_init)                        \
-    _MACRO(dom_destroy)                     \
-    _MACRO(vcpu_init)                       \
-    _MACRO(vcpu_destroy)                    \
-    _MACRO(vcpu_hot)
-
-#ifndef NDEBUG
-#define CSCHED_STATS_EXPAND_CHECKS(_MACRO)  \
-    _MACRO(vcpu_check)
-#else
-#define CSCHED_STATS_EXPAND_CHECKS(_MACRO)
-#endif
-
-#define CSCHED_STATS_EXPAND(_MACRO)         \
-    CSCHED_STATS_EXPAND_CHECKS(_MACRO)      \
-    CSCHED_STATS_EXPAND_SCHED(_MACRO)
-
-#define CSCHED_STATS_RESET()                                        \
-    do                                                              \
-    {                                                               \
-        memset(&csched_priv.stats, 0, sizeof(csched_priv.stats));   \
-    } while ( 0 )
-
-#define CSCHED_STATS_DEFINE()                   \
-    struct                                      \
-    {                                           \
-        CSCHED_STATS_EXPAND(CSCHED_STAT_DEFINE) \
-    } stats;
-
-#define CSCHED_STATS_PRINTK()                   \
-    do                                          \
-    {                                           \
-        printk("stats:\n");                     \
-        CSCHED_STATS_EXPAND(CSCHED_STAT_PRINTK) \
-    } while ( 0 )
-
-#define CSCHED_STAT_CRANK(_X)               (CSCHED_STAT(_X)++)
 
 #define CSCHED_VCPU_STATS_RESET(_V)                     \
     do                                                  \
@@ -170,10 +95,6 @@
 
 #else /* CSCHED_STATS */
 
-#define CSCHED_STATS_RESET()                do {} while ( 0 )
-#define CSCHED_STATS_DEFINE()
-#define CSCHED_STATS_PRINTK()               do {} while ( 0 )
-#define CSCHED_STAT_CRANK(_X)               do {} while ( 0 )
 #define CSCHED_VCPU_STATS_RESET(_V)         do {} while ( 0 )
 #define CSCHED_VCPU_STAT_CRANK(_V, _X)      do {} while ( 0 )
 #define CSCHED_VCPU_STAT_SET(_V, _X, _Y)    do {} while ( 0 )
@@ -239,7 +160,6 @@ struct csched_private {
     uint32_t credit;
     int credit_balance;
     uint32_t runq_sort;
-    CSCHED_STATS_DEFINE()
 };
 
 
@@ -1339,8 +1259,6 @@ csched_dump(void)
     cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), csched_priv.idlers);
     printk("idlers: %s\n", idlers_buf);
 
-    CSCHED_STATS_PRINTK();
-
     printk("active vcpus:\n");
     loop = 0;
     list_for_each( iter_sdom, &csched_priv.active_sdom )
@@ -1371,7 +1289,6 @@ csched_init(void)
     csched_priv.credit = 0U;
     csched_priv.credit_balance = 0;
     csched_priv.runq_sort = 0U;
-    CSCHED_STATS_RESET();
 }
 
 /* Tickers cannot be kicked until SMP subsystem is alive. */
diff -r f57ac4af36b4 -r b249f3e979a5 xen/include/xen/perfc_defn.h
--- a/xen/include/xen/perfc_defn.h      Mon Mar 09 09:56:16 2009 +0000
+++ b/xen/include/xen/perfc_defn.h      Mon Mar 09 10:32:24 2009 +0000
@@ -16,6 +16,40 @@ PERFCOUNTER(sched_run,              "sch
 PERFCOUNTER(sched_run,              "sched: runs through scheduler")
 PERFCOUNTER(sched_ctx,              "sched: context switches")
 
+PERFCOUNTER(vcpu_check,             "csched: vcpu_check")
+PERFCOUNTER(schedule,               "csched: schedule")
+PERFCOUNTER(acct_run,               "csched: acct_run")
+PERFCOUNTER(acct_no_work,           "csched: acct_no_work")
+PERFCOUNTER(acct_balance,           "csched: acct_balance")
+PERFCOUNTER(acct_reorder,           "csched: acct_reorder")
+PERFCOUNTER(acct_min_credit,        "csched: acct_min_credit")
+PERFCOUNTER(acct_vcpu_active,       "csched: acct_vcpu_active")
+PERFCOUNTER(acct_vcpu_idle,         "csched: acct_vcpu_idle")
+PERFCOUNTER(vcpu_sleep,             "csched: vcpu_sleep")
+PERFCOUNTER(vcpu_wake_running,      "csched: vcpu_wake_running")
+PERFCOUNTER(vcpu_wake_onrunq,       "csched: vcpu_wake_onrunq")
+PERFCOUNTER(vcpu_wake_runnable,     "csched: vcpu_wake_runnable")
+PERFCOUNTER(vcpu_wake_not_runnable, "csched: vcpu_wake_not_runnable")
+PERFCOUNTER(vcpu_park,              "csched: vcpu_park")
+PERFCOUNTER(vcpu_unpark,            "csched: vcpu_unpark")
+PERFCOUNTER(tickle_local_idler,     "csched: tickle_local_idler")
+PERFCOUNTER(tickle_local_over,      "csched: tickle_local_over")
+PERFCOUNTER(tickle_local_under,     "csched: tickle_local_under")
+PERFCOUNTER(tickle_local_other,     "csched: tickle_local_other")
+PERFCOUNTER(tickle_idlers_none,     "csched: tickle_idlers_none")
+PERFCOUNTER(tickle_idlers_some,     "csched: tickle_idlers_some")
+PERFCOUNTER(load_balance_idle,      "csched: load_balance_idle")
+PERFCOUNTER(load_balance_over,      "csched: load_balance_over")
+PERFCOUNTER(load_balance_other,     "csched: load_balance_other")
+PERFCOUNTER(steal_trylock_failed,   "csched: steal_trylock_failed")
+PERFCOUNTER(steal_peer_idle,        "csched: steal_peer_idle")
+PERFCOUNTER(migrate_queued,         "csched: migrate_queued")
+PERFCOUNTER(migrate_running,        "csched: migrate_running")
+PERFCOUNTER(dom_init,               "csched: dom_init")
+PERFCOUNTER(dom_destroy,            "csched: dom_destroy")
+PERFCOUNTER(vcpu_init,              "csched: vcpu_init")
+PERFCOUNTER(vcpu_destroy,           "csched: vcpu_destroy")
+
 PERFCOUNTER(need_flush_tlb_flush,   "PG_need_flush tlb flushes")
 
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] scheduler: Use perf_counter subsystem for stats, Xen patchbot-unstable <=