How do I get CPU Clock Speed in C++ (Linux)?

naspinski picture naspinski · Mar 10, 2010 · Viewed 9k times · Source

How can I get the CPU clock speed in C++?

I am running Ubuntu 9.10 if that makes any difference.

Answer

anon picture anon · Mar 10, 2010

Read the pseudo-file /proc/cpuinfo. See this link for an explanation of the fields it contains.