RE: Need help with accurate timers for multithreaded programs on Linux/X-86
"Hu, Boris" <[email protected]> Thu, 20 Nov 2003 13:26:30 +0800
| Newsgroups | gmane.comp.lib.phil |
|---|---|
| Message-ID | <37FBBA5F3A361C41AB7CE44558C3448E02775972@pdsmsx403.ccr.corp.intel.com> |
There are several POSIX timer_* API in nptl such as timer_create(), timer_gettime(), etc. nptl/sysdeps/pthread/tst-timer.c shows how to use them. Another one is http://sourceforge.net/projects/high-res-timers. > > Hi Folks, > I will appreciate if people can point me to accurate and reliable > timers for multithreaded programs on Linux/X-86 (specifically RH9.0). > > I have quite a bit of multithreading experience (mainly on Solaris) > but very little on Linux. On Solaris, the two timers: gethrvtime() > and gethrtime() are proving to be very valuable in tuning/testing > the code that I am currently multithreading. > > On Linux, I have tried both gettimeofday based timer and a timer > using RDTSC instruction in IA-32 but am not able to get repeatable > and reliable timings with these...well bottomline is that we are > seeing reasonable scaling (eg. 1.6-1.7X on 2-way) on Solaris (version > 8) > but basically none on Linux (RH 9.0). I suspect my lack of > experience on Linux is probably the reason...hence request for > help from you all. > > I know this is a very general question but any pointers you all > can provide on how to accurately measure time in portions of > code (on a per-thread basis) and/or if I should try a different > version of Linux thread library will be really appreciated. > > regards, > > --Rajat