<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[sleep() oder QueryPerformanceCounter?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe folgenden Code geschrieben:</p>
<pre><code>for(int i=0;i&lt;1;i++) {
	QueryPerformanceCounter((LARGE_INTEGER*)&amp;CurentCount); 

	//for(int i=0; i &lt; 10000; i++) 
	   Sleep(10);

	QueryPerformanceCounter((LARGE_INTEGER*)&amp;LastCount); 

	timeDiff=(((double)(LastCount-CurentCount))/((double)Frequency));
}
</code></pre>
<p>Ausgabe:<br />
timeDiff=0.015457 s</p>
<p>wer macht eurer Meinung nach den größeren Fehler? sleep() oder QueryPerformanceCounter?.. das sind ja immerhin 30% abweichung.<br />
Bei Sleep(1) ist es noch schlimmer..<br />
Blöd wäre wenn beide eine hohe Abweichung hätten</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/186852/sleep-oder-queryperformancecounter</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 00:43:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/186852.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 13 Jul 2007 06:28:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sleep() oder QueryPerformanceCounter? on Fri, 13 Jul 2007 06:28:35 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe folgenden Code geschrieben:</p>
<pre><code>for(int i=0;i&lt;1;i++) {
	QueryPerformanceCounter((LARGE_INTEGER*)&amp;CurentCount); 

	//for(int i=0; i &lt; 10000; i++) 
	   Sleep(10);

	QueryPerformanceCounter((LARGE_INTEGER*)&amp;LastCount); 

	timeDiff=(((double)(LastCount-CurentCount))/((double)Frequency));
}
</code></pre>
<p>Ausgabe:<br />
timeDiff=0.015457 s</p>
<p>wer macht eurer Meinung nach den größeren Fehler? sleep() oder QueryPerformanceCounter?.. das sind ja immerhin 30% abweichung.<br />
Bei Sleep(1) ist es noch schlimmer..<br />
Blöd wäre wenn beide eine hohe Abweichung hätten</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324284</guid><dc:creator><![CDATA[woldo]]></dc:creator><pubDate>Fri, 13 Jul 2007 06:28:35 GMT</pubDate></item><item><title><![CDATA[Reply to sleep() oder QueryPerformanceCounter? on Fri, 13 Jul 2007 06:32:51 GMT]]></title><description><![CDATA[<p>Erstens: Die ganzen Operationen um das Sleep() herum kosten auch ein wenig Zeit (inklusive der QPC-Aufrufe).</p>
<p>Zweitens: Windows ist ein Multi-Tasking-System. Und wenn Sleep() fertig ist, kann es durchaus sein, daß gerade ein anderer Prozess beschäftigt ist - und dann mußt du halt etwas länger warten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324289</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 13 Jul 2007 06:32:51 GMT</pubDate></item><item><title><![CDATA[Reply to sleep() oder QueryPerformanceCounter? on Fri, 13 Jul 2007 06:43:01 GMT]]></title><description><![CDATA[<p>Sleep(1-15) ist auf einem Multi-Prozessor-System immer 15 ms (Single-Prozessor: 10ms).<br />
Du kannst es mittels &quot;timeBeginPeriod&quot; auf bis zu 2 ms reduzieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324300</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 13 Jul 2007 06:43:01 GMT</pubDate></item></channel></rss>