<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 17 Mar 2016, at 02:03, Shuai Zhao <<a href="mailto:zs673@york.ac.uk" class="">zs673@york.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi<div class=""><br class=""></div><div class="">I got more information.</div><div class=""><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">The result I showed in the first email is tested with hyper thread disabled. In the result the interval of thread cpu timer goes greater than that of wall clock so we get a difference of a negative value.</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">However, if I enable the hyperthreading in BIOS, the wall clock will always greater so we get a difference of positive value. Yet the value will still double if I double the loop time.</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Do you have any idea why this happens?</div></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Best wishes</div><div style="font-size:12.8px" class="">Shuai</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 16 March 2016 at 23:22, Shuai Zhao <span dir="ltr" class=""><<a href="mailto:zs673@york.ac.uk" target="_blank" class="">zs673@york.ac.uk</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi All<div class=""><br class=""></div><div class="">Thank you for helping.</div><div class=""><br class=""></div><div class="">1. It happens both on Generic Linux kernel and Litmus. I suppose that it is an issue with generic Linux or my machine. But I think you may now the answer as you also deal with clocks in Litmus.</div><div class=""><br class=""></div><div class="">2. It seems that NTP is not responsible as I tried with clock CLOCK_MONOTONIC_RAW as well, but get same results. </div><div class=""><br class=""></div><div class="">3. Yes, I bind the thread to core 1 during its life time but still same results. </div><div class=""><br class=""></div><div class="">More info, I tried out the same test program on a laptop and the results are opposite. The difference between thread cpu timer and wall clock still doubles but the interval of wall clock is always greater. Yet on my desktop the interval of thread cpu time is greater. Really Really weird. The cpu clock speed on the laptop is 2000 MHz but it runs at 1996 MHz.</div><div class=""><br class=""></div><div class="">I attached the program here so you can also try out at your side. Compile with <span style="font-size:12.8px" class="">gcc -g -Wall -O2 clock.c -lrt -lpthread. The program takes a param to set how many times the thread will loop. </span></div><div class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8px" class="">Thank you for helping again.</span></div><div class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8px" class="">Best wishes</span></div><span class="HOEnZb"><font color="#888888" class=""><div class=""><span style="font-size:12.8px" class="">Shuai</span></div></font></span></div></blockquote></div></div></div></blockquote></div><div><br class=""></div><div><br class=""></div><div>As I said, I haven’t seen this behavior before, but my guess would be that it might have something to do with Intel’s Turbo Boost feature (unless you disabled that in the BIOS). </div><div><br class=""></div><div>In any case, since it is present in vanilla Linux, I’m afraid we probably won’t be able to offer too much help here. Perhaps StackOverflow or some other general Q&A forum is a better place to get more information on this.</div><div><br class=""></div><div>- Björn</div><div><br class=""></div><div><br class=""></div></body></html>