This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/15516] assembly snippets for nano second resolution wall clock time
- From: "jv244 at cam dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Feb 2007 10:55:44 -0000
- Subject: [Bug libfortran/15516] assembly snippets for nano second resolution wall clock time
- References: <bug-15516-8569@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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