Re: OT: recommended way of timing two pieces of code in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks!

On Fri, 26 Feb 2016 10:16:18 -0500 Tom Horsley <horsley1953@xxxxxxxxx> wrote:

> On Fri, 26 Feb 2016 08:31:07 -0600
> Ranjan Maitra wrote:
> 
> > I have been using get_rusage but I was wondering whether there is a better way?
> 
> You most accurate wall time is going to come from looking at
> the TSC register (if you are on an x86 processor)
> 
> https://en.wikipedia.org/wiki/Time_Stamp_Counter
> -- 

Yes, I am on an x86_64 Intel processor.

So, here is the problem I am having. I tried running the following timing program:

https://github.com/ChisholmKyle/PosixMachTiming

with the value in the loop increased to UINT_MAX to get better precision. (It also uses clock_gettime().) 

And then I run it twice but get different precisions. How does this happen? The number of operations are exactly the same (or should be). 

Many thanks and best wishes,
Ranjan

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux