<?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[Zeitmessung in VC++]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe ein Problem mit der Laufzeitmessung in VC++. Zwar kenne ich Mittel und Wege die Laufzeit zu messen (QueryPerformanceCounter, clock() etc.), diese messen jedoch jeweils die &quot;elapsed&quot; oder &quot;wall clock&quot; time. Ich bin allerdings an der reinen cpu-time für mein Programm interessiert. Hat jemand eine Idee, wie das funktionieren könnte? Unter Linux geht das ja, für VC++ habe ich allerdings noch keine Lösung gefunden.</p>
<p>MfG Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/195593/zeitmessung-in-vc</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 11:49:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/195593.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Oct 2007 11:45:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeitmessung in VC++ on Fri, 19 Oct 2007 11:45:51 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich habe ein Problem mit der Laufzeitmessung in VC++. Zwar kenne ich Mittel und Wege die Laufzeit zu messen (QueryPerformanceCounter, clock() etc.), diese messen jedoch jeweils die &quot;elapsed&quot; oder &quot;wall clock&quot; time. Ich bin allerdings an der reinen cpu-time für mein Programm interessiert. Hat jemand eine Idee, wie das funktionieren könnte? Unter Linux geht das ja, für VC++ habe ich allerdings noch keine Lösung gefunden.</p>
<p>MfG Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1388487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1388487</guid><dc:creator><![CDATA[Anschnei]]></dc:creator><pubDate>Fri, 19 Oct 2007 11:45:51 GMT</pubDate></item><item><title><![CDATA[Reply to Zeitmessung in VC++ on Fri, 19 Oct 2007 15:15:40 GMT]]></title><description><![CDATA[<p>GetProcessTimes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1388618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1388618</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 19 Oct 2007 15:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to Zeitmessung in VC++ on Mon, 22 Oct 2007 09:45:07 GMT]]></title><description><![CDATA[<p>Danke für den Tip. Kannst du das vielleicht etwas näher erläutern, bzw. ein kleines Beispiel dazu schreiben? Ich werde aus GetProcessTimes() bisher nicht wirklich schlau. Ich bin kein Programmier-Experte, muss jedoch für meine Diplomarbeit in Mathematik meine Algorithmen implementieren und benötige eine adäquate Zeitmessung dazu.</p>
<p>-MfG Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389809</guid><dc:creator><![CDATA[Anschnei]]></dc:creator><pubDate>Mon, 22 Oct 2007 09:45:07 GMT</pubDate></item><item><title><![CDATA[Reply to Zeitmessung in VC++ on Mon, 22 Oct 2007 13:48:22 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">FILETIME creationTime;
FILETIME exitTime;
FILETIME kernelTime;
FILETIME userTime;

BOOL rc = GetProcessTimes(GetCurrentProcess(), &amp;creationTime, &amp;exitTime, &amp;kernelTime, &amp;userTime);
if (!rc)
    fehler();
__int64 kt = __int64(kernelTime.dwLowDateTime) + (__int64(kernelTime.dwHighDateTime) &lt;&lt; 32); // kernelmode time
__int64 ut = __int64(userTime.dwLowDateTime) + (__int64(userTime.dwHighDateTime) &lt;&lt; 32); // usermode time
kt *= 100;
ut *= 100;
// kt und ut sind jetzt in ns
__int64 t = kt + ut; // total cpu time
</code></pre>
<p>p.S.: die Zeiten die du zurückbekommst sind pro CPU/Core Zeiten, also 1 Sekunde heisst 1 Sekunde auf einem Core. Laufen 2 Threads in deinem Programm für 1 Sekunde gleichzeitig auf 2 Cores gleichzeitig bekommst du 2 (!) Sekunden CPU Zeit zurück -- die CPU Zeit kann also &quot;schneller&quot; laufen als die reale Zeit (weils ja mehr als 1 CPU geben kann).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1389996</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1389996</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Mon, 22 Oct 2007 13:48:22 GMT</pubDate></item></channel></rss>