<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>a5: problems with timing on eeepc</title>
		<link>http://www.allegro.cc/forums/view/600859</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 16 Jul 2009 15:15:34 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />I am using an Asus EEEPC 901.<br />(Atom 270, 1GB RAM, 16GB Flash, WinXP, GCC 4, A5 4.9.11)<br />The a5 timer example runs uneven and slower than expected.<br />I noticed that the timer al_current_time() represents runs too slow... <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /><br />One second of al_current_time() lasts nearly for two seconds in rl.<br />Are there known issues running a5 timers on Intel Atom 270 ?<br />Can someone imagine what is going wrong here?</p><p>I just noticed that I&#39;m not using an up-to-date version of a5. But there didn&#39;t changed so much concerning timers. Nevertheless I will change to 4.9.12 as soon as I&#39;m home again.</p><p>Thx
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Seppl)</author>
		<pubDate>Fri, 10 Jul 2009 13:49:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The implementation is in src/win/wtime.c (low_res_current_time, high_res_current_time).  I would check how the underlying functions perform outside of Allegro.  The code hasn&#39;t changed for ages so updating Allegro won&#39;t make a difference.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Fri, 10 Jul 2009 14:04:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The inaccuracy of the timer has been pointed out before. I wonder if it is something wrong with the implementation. It has been noted to be wrong on all platforms.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Fri, 10 Jul 2009 18:22:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I suspect again that this is an issue related to assuming that ticks/seconds remains constant throughout a program&#39;s execution, and grows monotonically. This is not the case for multicore systems or system that automatically downstep processor frequency (like the eee).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Fri, 10 Jul 2009 18:24:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm, but which processor doesn&#39;t do that any more?</p><p>Still, you might be right.  Can whoever suffers from this problem try to disable the &quot;high_res&quot; timer in wtime.c?  It does look a bit dodgy.  It&#39;s just a small edit to the _al_win_init_time() function.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 16 Jul 2009 04:35:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried searching the forums for that sub-bitmap vs. regular bitmap thread but I couldn&#39;t find it. The code in that thread didn&#39;t work right for me IIRC.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 16 Jul 2009 07:12:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Presumably that was in response to something else..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 16 Jul 2009 08:25:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/600859/820869#target">X-G</a> said:</div><div class="quote"><p>
This is not the case for multicore systems or system that automatically downstep processor frequency (like the eee)
</p></div></div><p>
There are at least two timer chips in a PC that have nothing to do with CPU frequency.  The frequencies of these are far in excess of what a game demands...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 16 Jul 2009 10:27:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If possible update the BIOS for your eee pc...<br />It could be problem AAG25 (or AAG34) for Intel Atom N270 Stepping C0 processors...  If the timer works the way I think it does then this could be it...</p><p>Quote from <a href="http://download.intel.com/design/processor/specupdt/320047.pdf">http://download.intel.com/design/processor/specupdt/320047.pdf</a></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
</p><pre>
AAG25 Split Locked Stores or Locked Stores Through Certain Segments May
not Trigger the Monitoring Hardware

Problem: Logical processors normally resume program execution following the MWAIT, when
another logical processor performs a write access to a WB cacheable address within
the address range used to perform the MONITOR operation. Due to this erratum, a
logical processor may not resume execution until the next targeted interrupt event or
O/S timer tick following a locked store within the monitored address range that either
spans across cache lines or uses a segment register whose segment base is noncacheline
aligned.

Implication: The logical processor that executed the MWAIT instruction may not resume execution
until the next targeted interrupt event or O/S timer tick in the case where the
monitored address is written by a locked store which is either split across cache lines
or through a segment whose segment base bits 5 to 0 are non-zero.
Workaround: Avoid accessing the monitored address range using either locked stores that split
cache lines or locked stores that use a segment with a non-cacheline aligned segment
base. It is possible for the BIOS to contain a workaround for this erratum

Status: For the steppings affected, see the Summary Tables of Changes.
</pre><p>
</p></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ron Novy)</author>
		<pubDate>Thu, 16 Jul 2009 11:57:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/600859/821832#target">Arthur Kalliokoski</a> said:</div><div class="quote"><p>There are at least two timer chips in a PC that have nothing to do with CPU frequency.</p></div></div><p>

Sure. The problem is that certain methods of measuring time, such as RDTSC and, more oddly, QueryPerformanceCounter (which is odd because QPC is explicitly intended NOT to be subject to the RDTSC issue -- this is mainly a problem, I think, because MSDN&#39;s documentation outright lies to you on one critical point), still suffer from the problem and are very commonly used. Not knowing what A5 uses for its high-performance timing, I can&#39;t say which one it is; but for timing purposes, anything that relies on CPU clock frequency is no longer an accurate way to do it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 16 Jul 2009 15:15:34 +0000</pubDate>
	</item>
</rss>
