Search code examples
c++clinuxcpu-speed

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


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

I am running Ubuntu 9.10 if that makes any difference.


Solution

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