------- Comment #2 from jv244 at cam dot ac dot uk 2007-02-11 10:55 ------- (In reply to comment #0) > If you extract the object > file get_clockfreq.o from /usr/lib/librt.a then you can call the function > __get_clockfreq() to determine clock frequency. To extract the routine, try: > > ar xv /usr/lib/librt.a get_clockfreq.o > > To use the routines as timers, you can use the following routine. Call it > before > and after the section of code you want to time and the difference will be the > elapsed time. Be sure to include the appropriate routine from above.
is this comment about get_clockfreq.o actually correct ? I find it returns different values depending on the load of the machine (I guess this is frequency rescaling at work, i.e.): 46799775 1596000000 0.029323167293233084 46703250 1596000000 0.029262687969924813 40773807 1596000000 0.02554749812030075 34589439 2394000000 0.014448387218045113 33201315 1596000000 0.020802828947368422 34758144 2394000000 0.014518857142857142 33325110 1596000000 0.020880394736842105 34576236 2394000000 0.014442872180451127 where the first number is the ticks as returned by differences of nanotime_ia32, and the second the number returned by get_clockfreq, the third is the estimated time if seconds (quite random, since it is allways the same matrix multiply). (an unrelated issue is that it wraps pretty quicky...) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15516