summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-09-04 19:01:03 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-09-04 19:01:03 +0000
commitf1cb16d7feb1676818f1a8a5862b1c454b015ffd (patch)
tree89512eb36a1168cfe4a0a676050ec32cb4a0f8c6
parent4de2bb9a0551ef0503cd0472921e64f3a45abb95 (diff)
Revert previous change, but use curcpu()->ci_schedstate.spc_cp_time[] instead
of global cp_time[] for live information, as loadavg is not updated fast enough for hz/16 blinking rate. Prompted by feedback from mickey@
-rw-r--r--sys/arch/hppa/hppa/autoconf.c24
-rw-r--r--sys/arch/hppa64/hppa64/autoconf.c24
2 files changed, 32 insertions, 16 deletions
diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c
index 5360a6a0f4e..41244c48069 100644
--- a/sys/arch/hppa/hppa/autoconf.c
+++ b/sys/arch/hppa/hppa/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.59 2014/08/29 21:21:39 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.60 2014/09/04 19:01:02 miod Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -107,16 +107,24 @@ void
heartbeat(v)
void *v;
{
- static u_int hbcnt = 0;
- int toggle, cp_mask;
+ static u_int hbcnt = 0, ocp_total, ocp_idle;
+ int toggle, cp_mask, cp_total, cp_idle;
+ struct schedstate_percpu *spc = &(curcpu()->ci_schedstate);
timeout_add(&heartbeat_tmo, hz / 16);
- /* display the load average in the upper leds if any */
- cp_mask = averunnable.ldavg[0] >> FSHIFT;
- if (cp_mask > 0x0f)
- cp_mask = 0x0f;
- cp_mask <<= 4;
+ cp_idle = spc->spc_cp_time[CP_IDLE];
+ cp_total = spc->spc_cp_time[CP_USER] + spc->spc_cp_time[CP_NICE] +
+ spc->spc_cp_time[CP_SYS] + spc->spc_cp_time[CP_INTR] +
+ spc->spc_cp_time[CP_IDLE];
+ if (cp_total == ocp_total)
+ cp_total = ocp_total + 1;
+ if (cp_idle == ocp_idle)
+ cp_idle = ocp_idle + 1;
+ cp_mask = 0xf0 >> (cp_idle - ocp_idle) * 4 / (cp_total - ocp_total);
+ cp_mask &= 0xf0;
+ ocp_total = cp_total;
+ ocp_idle = cp_idle;
/*
* do this:
*
diff --git a/sys/arch/hppa64/hppa64/autoconf.c b/sys/arch/hppa64/hppa64/autoconf.c
index 5b56334791d..ab8e9b8d05e 100644
--- a/sys/arch/hppa64/hppa64/autoconf.c
+++ b/sys/arch/hppa64/hppa64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.19 2014/08/29 21:21:39 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.20 2014/09/04 19:01:02 miod Exp $ */
/*
* Copyright (c) 1998-2005 Michael Shalayeff
@@ -148,16 +148,24 @@ diskconf(void)
void
heartbeat(void *v)
{
- static u_int hbcnt = 0;
- int toggle, cp_mask;
+ static u_int hbcnt = 0, ocp_total, ocp_idle;
+ int toggle, cp_mask, cp_total, cp_idle;
+ struct schedstate_percpu *spc = &(curcpu()->ci_schedstate);
timeout_add(&heartbeat_tmo, hz / 16);
- /* display the load average in the upper leds if any */
- cp_mask = averunnable.ldavg[0] >> FSHIFT;
- if (cp_mask > 0x0f)
- cp_mask = 0x0f;
- cp_mask <<= 4;
+ cp_idle = spc->spc_cp_time[CP_IDLE];
+ cp_total = spc->spc_cp_time[CP_USER] + spc->spc_cp_time[CP_NICE] +
+ spc->spc_cp_time[CP_SYS] + spc->spc_cp_time[CP_INTR] +
+ spc->spc_cp_time[CP_IDLE];
+ if (cp_total == ocp_total)
+ cp_total = ocp_total + 1;
+ if (cp_idle == ocp_idle)
+ cp_idle = ocp_idle + 1;
+ cp_mask = 0xf0 >> (cp_idle - ocp_idle) * 4 / (cp_total - ocp_total);
+ cp_mask &= 0xf0;
+ ocp_total = cp_total;
+ ocp_idle = cp_idle;
/*
* do this:
*