<?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[QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>habe ein seltsames Problem. Im folgenden Code ist nTicksDiff manchmal negativ!<br />
Werte sind dann z.B.:<br />
nTicksDiff = -326070<br />
CurrentCount = 14192143508954<br />
LastCount = 14192143182884</p>
<pre><code class="language-cpp">LONGLONG CurrentCount, LastCount;

	LONGLONG nTicksDiff;

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

	if(max_X&lt;x)
		max_X=x;
	if(max_Y&lt;y)
		max_Y=y;
	if(max_Z&lt;z)
		max_Z=z;
	if(plotter)
		plotter(x, y, z, pUserDataPlotter);

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

	nTicksDiff = (LastCount - CurrentCount);
</code></pre>
<p>Wieso? Wie verhindere ich das?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/184789/queryperformancetimer-gibt-manchmal-kleinere-werte-zurück-als-zu-einem-früheren-zeitpunkt</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 17:08:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184789.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jun 2007 10:34:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Tue, 19 Jun 2007 10:34:45 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>habe ein seltsames Problem. Im folgenden Code ist nTicksDiff manchmal negativ!<br />
Werte sind dann z.B.:<br />
nTicksDiff = -326070<br />
CurrentCount = 14192143508954<br />
LastCount = 14192143182884</p>
<pre><code class="language-cpp">LONGLONG CurrentCount, LastCount;

	LONGLONG nTicksDiff;

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

	if(max_X&lt;x)
		max_X=x;
	if(max_Y&lt;y)
		max_Y=y;
	if(max_Z&lt;z)
		max_Z=z;
	if(plotter)
		plotter(x, y, z, pUserDataPlotter);

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

	nTicksDiff = (LastCount - CurrentCount);
</code></pre>
<p>Wieso? Wie verhindere ich das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1308961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308961</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Tue, 19 Jun 2007 10:34:45 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Tue, 19 Jun 2007 13:24:47 GMT]]></title><description><![CDATA[<p>Du hast vermutlich einen Athlon... (selber Schuld <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>
<p>Die haben halt einen Bug in Ihrem Prozessor... Schalte mal &quot;Cool&amp;Quite&quot; ab, dann solte der Bug &quot;behoben&quot; sein.</p>
<p>Siehe auch:<br />
<a href="http://support.microsoft.com/?scid=kb;en-us;895980" rel="nofollow">http://support.microsoft.com/?scid=kb;en-us;895980</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309151</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Tue, 19 Jun 2007 13:24:47 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Tue, 19 Jun 2007 13:27:28 GMT]]></title><description><![CDATA[<p>Einen AMD hab ich, ja.</p>
<p>Danke für die Info.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309154</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Tue, 19 Jun 2007 13:27:28 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Tue, 19 Jun 2007 13:44:44 GMT]]></title><description><![CDATA[<p>QueryPerformanceCounter kannst du sowieso vergessen wenn du ganz kurze Zeitspannen messen willst, das haut nicht hin. Ist ein Erfahrungswert.<br />
Ich hab' zwar IIRC noch nie negative Werte bekommen, aber sehr schrottige schon oft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309165</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 19 Jun 2007 13:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Tue, 19 Jun 2007 13:45:28 GMT]]></title><description><![CDATA[<p>Was schlägst du als Alternative vor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309166</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309166</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Tue, 19 Jun 2007 13:45:28 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 01:29:19 GMT]]></title><description><![CDATA[<p>Ein Oszilloskop?<br />
Ne ehrlich, mit den API Funktionen kommst du da nicht weit. Ich wüsste zumindest nicht wie.</p>
<p>Die einzig brauchbare Möglichkeit die ich kenne ist die zu messende Funktion in einen Loop zu packen damit die zu messende Zeitspanne grösser wird.<br />
Was wieder zu anderen Problemen führen kann, z.B. dass der Compiler u.U. den ganzen Loop (oder auch nur Teile davon) wegoptimiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309523</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309523</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Wed, 20 Jun 2007 01:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 07:16:58 GMT]]></title><description><![CDATA[<p>dEUs schrieb:</p>
<blockquote>
<p>Was schlägst du als Alternative vor?</p>
</blockquote>
<p><a href="http://support.microsoft.com/?scid=kb;en-us;895980" rel="nofollow">http://support.microsoft.com/?scid=kb;en-us;895980</a></p>
<p>!???????????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309612</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 20 Jun 2007 07:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 07:17:54 GMT]]></title><description><![CDATA[<p>Jochen Kalmbach schrieb:</p>
<blockquote>
<p>dEUs schrieb:</p>
<blockquote>
<p>Was schlägst du als Alternative vor?</p>
</blockquote>
<p><a href="http://support.microsoft.com/?scid=kb;en-us;895980" rel="nofollow">http://support.microsoft.com/?scid=kb;en-us;895980</a></p>
<p>!???????????</p>
</blockquote>
<p>Was willst du mir damit sagen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309613</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Wed, 20 Jun 2007 07:17:54 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 08:52:00 GMT]]></title><description><![CDATA[<blockquote>
<p>At the end of the line, add a space, and then type /usepmtimer.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1309703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309703</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 20 Jun 2007 08:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 08:53:40 GMT]]></title><description><![CDATA[<p>laut hustbaer ist QueryPerformanceTimer generel unbrauchbar. Unabhängig davon. Daher habe ich nach einer Alternative gefragt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309707</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Wed, 20 Jun 2007 08:53:40 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 10:14:39 GMT]]></title><description><![CDATA[<p>performance counter braucht selber ne gewisse zeit, um befragt zu werden.</p>
<p>davon abgesehen, cool'n'quiet kannste auch kurzzeitig deaktivieren: suche nach CrystalCPUID. da kannst du eigene stufen einstellen oder manuell festdrehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309749</guid><dc:creator><![CDATA[c.rackwitz]]></dc:creator><pubDate>Wed, 20 Jun 2007 10:14:39 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 10:29:19 GMT]]></title><description><![CDATA[<p>AFAIK gibt es keine sinnvolle Alternative... mir ist zumindest keine bekannt die nicht noch mehr Probleme verursacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309758</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 20 Jun 2007 10:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 12:25:20 GMT]]></title><description><![CDATA[<p>ok, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1309869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1309869</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Wed, 20 Jun 2007 12:25:20 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 16:52:22 GMT]]></title><description><![CDATA[<p>Was ich vergessen hatte zu schreiben: ich habe <strong>auf Intel Plattformen</strong> (z.B. P4 mit Hyperthreading) schrottige Werte bekommen, also schrottig im Sinne von &quot;relativ ungenau&quot;.</p>
<p>BTW: unbrauchbar würde ich nicht sagen, für Zeitspannen im Bereich 0,1ms oder so geht das schon gut, für Zeitspannen im einstelligen Microsekundenbereich dagegen weniger.</p>
<p>Ahja... was u.U. gehen könnte: direkt RDTSC verwenden und den Thread mittels Affinity auf einen Core festnageln. Hab' ich allerdings noch nie probiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310103</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Wed, 20 Jun 2007 16:52:22 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 16:56:36 GMT]]></title><description><![CDATA[<p>ok, wir haben offensichtlich unterschiedliche Vorstellungen von &quot;unbrauchbar&quot; <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="😉"
    /><br />
Mir reicht schon 1ms Genauigkeit sehr gut aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1310107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310107</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Wed, 20 Jun 2007 16:56:36 GMT</pubDate></item><item><title><![CDATA[Reply to QueryPerformanceTimer gibt manchmal kleinere Werte zurück als zu einem früheren Zeitpunkt on Wed, 20 Jun 2007 17:19:55 GMT]]></title><description><![CDATA[<p>Ah, ok.<br />
Mir nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Ich würde QueryPerformanceCounter gerne verwenden um z.B. Aufrufe wie malloc zu timen (bzw. allgemein halt Profiling von recht &quot;kurzen&quot; Funktionen), und die brauchen ja gottseidank weit unter 1ms.</p>
<p>EDIT: 1ms Genauigkeit: timeBeginPeriod(), timeGetTime(), timeEndPeriod(). <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/1310119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1310119</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Wed, 20 Jun 2007 17:19:55 GMT</pubDate></item></channel></rss>