[commit] r2245 - Improved high-priority ticker (deal with sleep). VMMaker image has reader cache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] r2245 - Improved high-priority ticker (deal with sleep). VMMaker image has reader cache

commits-3
 
Author: eliot
Date: 2010-07-20 16:00:57 -0700 (Tue, 20 Jul 2010)
New Revision: 2245

Modified:
   branches/Cog/image/VMMaker-Squeak4.1.changes
   branches/Cog/image/VMMaker-Squeak4.1.image
   branches/Cog/platforms/Cross/vm/sqTicker.c
Log:
Improved high-priority ticker (deal with sleep).  VMMaker image has reader cache
flushed (38Mb => 13Mb).


Modified: branches/Cog/image/VMMaker-Squeak4.1.changes
===================================================================
--- branches/Cog/image/VMMaker-Squeak4.1.changes 2010-07-20 18:20:26 UTC (rev 2244)
+++ branches/Cog/image/VMMaker-Squeak4.1.changes 2010-07-20 23:00:57 UTC (rev 2245)
@@ -124051,4 +124051,21 @@
 ----STARTUP----{19 July 2010 . 2:36:15 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
 
 
-----QUIT/NOSAVE----{19 July 2010 . 2:41:01 pm} VMMaker-Squeak4.1.image priorSource: 5003704!
\ No newline at end of file
+----QUIT/NOSAVE----{19 July 2010 . 2:41:01 pm} VMMaker-Squeak4.1.image priorSource: 5003704!
+
+----STARTUP----{20 July 2010 . 12:35:23 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
+
+
+TimeStamp instanceCount!
+
+----STARTUP----{20 July 2010 . 1:00:28 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
+
+
+MCFileBasedRepository flushAllCaches!
+
+----QUIT----{20 July 2010 . 1:00:59 pm} VMMaker-Squeak4.1.image priorSource: 5003704!
+
+----STARTUP----{20 July 2010 . 1:14:28 pm} as /Users/eliot/Cog/oscog/Cog.squeakvm.org/image/VMMaker-Squeak4.1.image!
+
+
+----QUIT/NOSAVE----{20 July 2010 . 1:14:37 pm} VMMaker-Squeak4.1.image priorSource: 5004308!
\ No newline at end of file

Modified: branches/Cog/image/VMMaker-Squeak4.1.image
===================================================================
(Binary files differ)

Modified: branches/Cog/platforms/Cross/vm/sqTicker.c
===================================================================
--- branches/Cog/platforms/Cross/vm/sqTicker.c 2010-07-20 18:20:26 UTC (rev 2244)
+++ branches/Cog/platforms/Cross/vm/sqTicker.c 2010-07-20 23:00:57 UTC (rev 2245)
@@ -193,6 +193,18 @@
  sqLowLevelMFence();
 }
 
+/* If the heartbeat fails to invoke checkHighPriorityTickees in a timely manner
+ * for wahtever reason (e.g. the user has put the machine to sleep) we need to
+ * readjust the deadline, moving it forward to a delta from the current time.
+ * If we don't then the heartbeat will spin calling checkHighPriorityTickees as
+ * it inches forward at tickeePeriodUsecs.  But if we always base the deadline
+ * on the current time and for whatever reason there is a slight hiccup then all
+ * subsequent deadlines will be pushed into the future.  The HiccupThreshold of
+ * 10 seconds distinguishes between the two cases; longer than 10 seconds and we
+ * assume the system has slept.
+ */
+#define HiccupThreshold 10000000ULL /* 10 seconds */
+
 void
 checkHighPriorityTickees(usqLong utcMicrosecondClock)
 {
@@ -217,7 +229,13 @@
  sqCompareAndSwapRes(async[i].inProgress,0,1,previousInProgress);
  if (previousInProgress == 0) {
  assert(async[i].inProgress);
- async[i].tickeeDeadlineUsecs += async[i].tickeePeriodUsecs;
+ if (async[i].tickeeDeadlineUsecs + HiccupThreshold
+ < utcMicrosecondClock)
+ async[i].tickeeDeadlineUsecs
+ = utcMicrosecondClock + async[i].tickeePeriodUsecs;
+ else
+ async[i].tickeeDeadlineUsecs
+ += async[i].tickeePeriodUsecs;
  async[i].tickee();
  async[i].inProgress = 0;
  }