This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

clock_gettime, get_clockfreq

I'm trying to understand how clock_gettime works and I'm uncertain as to
how scaled CPU frequencies are handled.

If I look at the clock_gettime code it calls a function call
get_clockfreq.  This patterns is the same in multiple versions of this code.

On linux this frequency is read once from the '/proc/cpuinfo' file. This
information I believe is set only once at system startup. However,
during operations the actual frequency will change. I can indeed get it
to have any number of values in the cpuinfo file. How does clock_gettime
actually resolve this issue? Does the TSC somehow automatically
represent clock-cycles in this listed frequency?

Also, I noticed a 4096 buffer in get_clockfreq which reads the timer.
There is a counter which says proc won't produce larger files, yet I
have system where the 'cpuinfo' file is clearly larger than this. I'm
sure the first 4K will have a speed in it, but the speed does not need
to be the same across all CPUs.

Note: I'm looking at the x86_64 code for Linux.

edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

Attachment: signature.asc
Description: OpenPGP digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]