<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Using a more accurate approach to Timing</title> <atom:link href="http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/feed" rel="self" type="application/rss+xml" /><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html</link> <description>This is a collection of interesting stuff that I found on the web or stuff I worked on at the time.</description> <lastBuildDate>Tue, 07 Feb 2012 20:01:32 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>By: alok</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-317369</link> <dc:creator>alok</dc:creator> <pubDate>Sun, 24 May 2009 21:03:22 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-317369</guid> <description>hi. its nice work. I want to create two threads and with the help of timer class
i want to throw these threads on different times. i read a lot of materials but didn&#039;t found anything which meets my requirement.Thank for your help and positive reply</description> <content:encoded><![CDATA[<p>hi. its nice work. I want to create two threads and with the help of timer class<br
/> i want to throw these threads on different times. i read a lot of materials but didn&#8217;t found anything which meets my requirement.</p><p>Thank for your help and positive reply</p> ]]></content:encoded> </item> <item><title>By: Tobias Hertkorn</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-297966</link> <dc:creator>Tobias Hertkorn</dc:creator> <pubDate>Thu, 29 Jan 2009 08:49:04 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-297966</guid> <description>Hi Marco,unfortuantelly, I don&#039;t know any high res timer that does not require a hot loop. And therefore would only work correctly on a dual cpu system (and 100%ing one of the cpus.) :) Not too optimal, is it? And I don&#039;t know how accurate Thread.Sleep(1) would be...And please be aware of the fact that writing to a log on disk will have a natural delay as well, since hard disks have a seek time of _several_ ms - and therefore might be the real reason why you don&#039;t see the expected interval.Cheers,
Tobi</description> <content:encoded><![CDATA[<p>Hi Marco,</p><p>unfortuantelly, I don&#8217;t know any high res timer that does not require a hot loop. And therefore would only work correctly on a dual cpu system (and 100%ing one of the cpus.) <img
src='http://www.fsmpi.uni-bayreuth.de/~dun3/tsharp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Not too optimal, is it? And I don&#8217;t know how accurate Thread.Sleep(1) would be&#8230;</p><p>And please be aware of the fact that writing to a log on disk will have a natural delay as well, since hard disks have a seek time of _several_ ms &#8211; and therefore might be the real reason why you don&#8217;t see the expected interval.</p><p>Cheers,<br
/> Tobi</p> ]]></content:encoded> </item> <item><title>By: Marco</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-297828</link> <dc:creator>Marco</dc:creator> <pubDate>Wed, 28 Jan 2009 14:57:40 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-297828</guid> <description>Hi Tobias,
Very nice. But I have a question.
I would like to create an Event that triggers every so many milliseconds. I only need 1ms accuracy at the most.
Now I&#039;ve tried the easy way with the Clock method. But not matter what I try for the Interval prop, the results are not reliable (1ms Interval gets me 14,15,16ms between the printed time in my log file - 20ms gives me 30,31,32ms).
Your methods is more accurate but only used as a stopwatch. Is there a way to generate an Event using this method? So I can do something simple (write a line to a log file) every so many ms?Thanks!Marco</description> <content:encoded><![CDATA[<p>Hi Tobias,<br
/> Very nice. But I have a question.<br
/> I would like to create an Event that triggers every so many milliseconds. I only need 1ms accuracy at the most.<br
/> Now I&#8217;ve tried the easy way with the Clock method. But not matter what I try for the Interval prop, the results are not reliable (1ms Interval gets me 14,15,16ms between the printed time in my log file &#8211; 20ms gives me 30,31,32ms).<br
/> Your methods is more accurate but only used as a stopwatch. Is there a way to generate an Event using this method? So I can do something simple (write a line to a log file) every so many ms?</p><p>Thanks!</p><p>Marco</p> ]]></content:encoded> </item> <item><title>By: max</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-134690</link> <dc:creator>max</dc:creator> <pubDate>Thu, 17 Jan 2008 14:01:40 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-134690</guid> <description>In your static constructor add calls to Start() and Stop() methods.
This will ensure that the methods have been &#039;jitted&#039; before first call...
Something like:
PerformanceTimer pt = new PerformanceTimer();
pt.Start();
pt.Stop();
pt = null;</description> <content:encoded><![CDATA[<p>In your static constructor add calls to Start() and Stop() methods.<br
/> This will ensure that the methods have been &#8216;jitted&#8217; before first call&#8230;<br
/> Something like:<br
/> PerformanceTimer pt = new PerformanceTimer();<br
/> pt.Start();<br
/> pt.Stop();<br
/> pt = null;</p> ]]></content:encoded> </item> <item><title>By: Tobias Hertkorn</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-49385</link> <dc:creator>Tobias Hertkorn</dc:creator> <pubDate>Tue, 12 Jun 2007 18:16:13 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-49385</guid> <description>Hi Carrie,the file you downloaded is not a complete C# program, it just represents a class that helps you time a program. but you have to write a complete c# program for it to work.You need to write something like this in a second file and compile:
&lt;code&gt;
class Example {
static void Main() {
PerformanceTimer timer = new PerformanceTimer();
timer.Start();
// do something here
timer.Stop();
Console.WriteLine(timer.DurationSeconds);
}
}
&lt;/code&gt;Please do start with some basic tutorials on C#.
&lt;a href=&quot;http://www.google.de/search?hl=en&amp;q=c%23+tutorial&quot; rel=&quot;nofollow&quot; rel=&quot;nofollow&quot;&gt;Pick a choose&lt;/a&gt;</description> <content:encoded><![CDATA[<p>Hi Carrie,</p><p>the file you downloaded is not a complete C# program, it just represents a class that helps you time a program. but you have to write a complete c# program for it to work.</p><p>You need to write something like this in a second file and compile:<br
/> <code><br
/> class Example {<br
/> static void Main() {<br
/> PerformanceTimer timer = new PerformanceTimer();<br
/> timer.Start();<br
/> // do something here<br
/> timer.Stop();<br
/> Console.WriteLine(timer.DurationSeconds);<br
/> }<br
/> }<br
/> </code></p><p>Please do start with some basic tutorials on C#.<br
/> <a
href="http://www.google.de/search?hl=en&#038;q=c%23+tutorial" rel="nofollow" rel="nofollow">Pick a choose</a></p> ]]></content:encoded> </item> <item><title>By: carrie</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-49065</link> <dc:creator>carrie</dc:creator> <pubDate>Mon, 11 Jun 2007 08:38:12 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-49065</guid> <description>hi,
i am the new learner for c#. after i copying your program to C# console application, an error occru
it write that
doesnt contain a static &quot;main&quot; method suitable for entry point
.What does it mean??
Thank you for help</description> <content:encoded><![CDATA[<p>hi,<br
/> i am the new learner for c#. after i copying your program to C# console application, an error occru<br
/> it write that<br
/> doesnt contain a static &#8220;main&#8221; method suitable for entry point<br
/> .What does it mean??<br
/> Thank you for help</p> ]]></content:encoded> </item> <item><title>By: Tobias Hertkorn</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-36541</link> <dc:creator>Tobias Hertkorn</dc:creator> <pubDate>Sun, 06 May 2007 21:56:52 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-36541</guid> <description>Hey Ben,the Thread.Sleep(0); is there to make it less likely that the to-be-timed thread will be put to suspended state by the thread-scheduler during the timing, because already waiting threads will get the chance to do their work before the timing starts. To quote the documentation on Thread.Sleep:
Specify zero (0) to indicate that this thread should be suspended to allow other waiting threads to execute.Therefore your conclusion is absolutely correct. The timing will be more accurate since by average the thread will be running with less suspended time. However: ideally your computer should not be occupied at all with other conflicting tasks during execution of the to-be-optimized code anyway. ;)Thanks,
Tobi</description> <content:encoded><![CDATA[<p>Hey Ben,</p><p>the Thread.Sleep(0); is there to make it less likely that the to-be-timed thread will be put to suspended state by the thread-scheduler during the timing, because already waiting threads will get the chance to do their work before the timing starts. To quote the documentation on Thread.Sleep:<br
/> Specify zero (0) to indicate that this thread should be suspended to allow other waiting threads to execute.</p><p>Therefore your conclusion is absolutely correct. The timing will be more accurate since by average the thread will be running with less suspended time. However: ideally your computer should not be occupied at all with other conflicting tasks during execution of the to-be-optimized code anyway. <img
src='http://www.fsmpi.uni-bayreuth.de/~dun3/tsharp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p>Thanks,<br
/> Tobi</p> ]]></content:encoded> </item> <item><title>By: ben</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-36053</link> <dc:creator>ben</dc:creator> <pubDate>Wed, 02 May 2007 12:38:33 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-36053</guid> <description>hey it looks good! I&#039;m just wondering why you sleep before starting the timer. Is that to make the timer a little more accurate for really short times by making sure the current thread can do some work before being scheduled out?</description> <content:encoded><![CDATA[<p>hey it looks good! I&#8217;m just wondering why you sleep before starting the timer. Is that to make the timer a little more accurate for really short times by making sure the current thread can do some work before being scheduled out?</p> ]]></content:encoded> </item> <item><title>By: kshysieq</title><link>http://www.fsmpi.uni-bayreuth.de/~dun3/archives/more-accurate-timing-stopwatch-performancetimer-queryperformancecounter/19.html/comment-page-1#comment-20021</link> <dc:creator>kshysieq</dc:creator> <pubDate>Mon, 12 Mar 2007 15:39:52 +0000</pubDate> <guid
isPermaLink="false">http://saftsack.fs.uni-bayreuth.de/~dun3/archives/uncategorized/using-a-more-accurate-approach-to-timing/19.html#comment-20021</guid> <description>really good stuff :)
it works fine to me !</description> <content:encoded><![CDATA[<p>really good stuff <img
src='http://www.fsmpi.uni-bayreuth.de/~dun3/tsharp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br
/> it works fine to me !</p> ]]></content:encoded> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 1/16 queries in 0.011 seconds using disk

Served from: btfmx2.fs.uni-bayreuth.de @ 2012-02-12 08:58:56 -->
