+ // In Linux version 2.6.23 and later, time time values are always
+ // reported in nanoseconds.
+ //
+ // This change appears to have been made in commit 425e0968a25f, which
+ // moved some of the sched stats code to a new file. Despite the commit
+ // message claiming "no code changes are caused by this patch", it changed
+ // the task.sched_info.cpu_time and task.sched_info.run_delay counters to be
+ // computed using sched_clock() rather than jiffies.
+ int linuxVersion;
+ try {
+ linuxVersion = getLinuxVersion(unameInfo.release);
+ } catch (const std::exception&) {
+ LOG(ERROR) << "unable to determine jiffies/second: failed to parse "
+ << "kernel release string \"" << unameInfo.release << "\"";
+ return -1;
+ }
+ if (linuxVersion >= 2006023) {
+ // The units are nanoseconds
+ return 1;
+ }
+
+ // In Linux versions prior to 2.6.23, the time values are reported in
+ // jiffies. This is somewhat unfortunate, as the number of jiffies per
+ // second is configurable. We have to determine the units being used.
+ //
+ // It seems like the only real way to figure out the CONFIG_HZ value used by
+ // this kernel is to look it up in the config file.
+ //
+ // Look in /boot/config-<kernel_release>