patch-2.1.129 linux/arch/ppc/amiga/time.c
Next file: linux/arch/ppc/apus_defconfig
Previous file: linux/arch/ppc/amiga/config.c
Back to the patch index
Back to the overall index
- Lines: 30
- Date:
Sun Nov 15 10:51:41 1998
- Orig file:
v2.1.128/linux/arch/ppc/amiga/time.c
- Orig date:
Thu Aug 6 14:06:29 1998
diff -u --recursive --new-file v2.1.128/linux/arch/ppc/amiga/time.c linux/arch/ppc/amiga/time.c
@@ -1,3 +1,4 @@
+#include <linux/config.h> /* CONFIG_HEARTBEAT */
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
@@ -68,3 +69,24 @@
}
+void apus_heartbeat (void)
+{
+#ifdef CONFIG_HEARTBEAT
+ static unsigned cnt = 0, period = 0, dist = 0;
+
+ if (cnt == 0 || cnt == dist)
+ mach_heartbeat( 1 );
+ else if (cnt == 7 || cnt == dist+7)
+ mach_heartbeat( 0 );
+
+ if (++cnt > period) {
+ cnt = 0;
+ /* The hyperbolic function below modifies the heartbeat period
+ * length in dependency of the current (5min) load. It goes
+ * through the points f(0)=126, f(1)=86, f(5)=51,
+ * f(inf)->30. */
+ period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
+ dist = period / 4;
+ }
+#endif
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov