changeset 13621:a726575d10f2

2099 powertop output hangs under heavy load Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: Dan McDonald <danmcd@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
author Milan Jurik <milan.jurik@xylab.cz>
date Sat, 25 Feb 2012 00:14:04 -0800
parents 97ffb0d8de52
children e5889df1eaac
files usr/src/cmd/powertop/common/powertop.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/powertop/common/powertop.c	Thu Feb 23 07:11:44 2012 +0400
+++ b/usr/src/cmd/powertop/common/powertop.c	Sat Feb 25 00:14:04 2012 -0800
@@ -397,7 +397,8 @@
 		 * specified an interval we skip this bit and keep it fixed.
 		 */
 		if (g_features & FEATURE_CSTATE && !PT_ON_TIME &&
-		    g_longest_cstate > 0) {
+		    g_longest_cstate > 0 &&
+		    g_cstate_info[g_longest_cstate].events > 0) {
 			double deep_idle_res = (((double)
 			    g_cstate_info[g_longest_cstate].total_time/MICROSEC
 			    /g_ncpus)/g_cstate_info[g_longest_cstate].events);