http://defect.opensolaris.org/bz/show_bug.cgi?id=2948





--- Comment #4 from Aubrey.Li <aubrey.li at intel.com>  2009-02-19 22:48:32 ---
paste here to review convenience.


diff -r 5f4975a74953 usr/src/cmd/powertop/common/display.c
--- a/usr/src/cmd/powertop/common/display.c     Wed Feb 18 14:44:47 2009 +0800
+++ b/usr/src/cmd/powertop/common/display.c     Fri Feb 20 14:44:44 2009 +0800
@@ -329,13 +329,32 @@
 void
 show_wakeups(double interval)
 {
-       char    c[100];
+       char            c[100];
+       int             i, event_sum = 0;
+       event_info_t    *g_p_event = g_event_info;

        if (!PTOP_ON_DUMP) {
                (void) werase(wakeup_window);
                (void) wbkgd(wakeup_window, COLOR_PAIR(PT_COLOR_RED));
                (void) wattron(wakeup_window, A_BOLD);
        }
+
+       /*
+        * calculate the actual total event number
+        */
+       for (i = 0; i < g_tog_p_events; i++, g_p_event++)
+               event_sum += g_p_event->total_count;
+
+       /*
+        * g_total_events is the sum of the number of Cx->C0 transition,
+        * So when the system is very busy, the idle thread will have no
+        * chance or very seldom to be scheduled, this could cause >100%
+        * event report. Re-assign g_total_events to the actual event
+        * number is a way to avoid this issue.
+        */
+       if (event_sum > g_total_events)
+               g_total_events = event_sum;
+
        (void) sprintf(c, "Wakeups-from-idle per second: %4.1f\tinterval: "
            "%.1fs", (double)(g_total_events/interval), interval);
        print(wakeup_window, 0, 0, "%s\n", c);

-- 
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to