Skip to content

cphrmky/clocks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code to test various clocks under Linux (and OSX)

Some quick notes on the code:

  • The ClockTest.sh script compiles the code, and executes the test programs. It uses taskset to ensure that the tests don't migrate to different CPUs. (taskset is done only for the C++ test – the JVM uses so many threads that pinning them all to a single CPU is probably not a good idea). You'll need to modify the script to specify the correct location for JAVA_HOME on your system, or set JAVA_HOME prior to calling the script.

  • The script detects whether the rdtscp instruction is available by querying /proc/cpuinfo. If not, it bypasses that code (which would otherwise throw a SIGILL).

  • You can also pass in the CPU frequency, in GHz. If you don't, then a frequency of 1 is used, which has the effect of returning the tick count unmodified for those clock sources that use tick counts (i.e., anything having to do with the RDTSC instruction).

  • If the script doesn't seem to be working, execute it with “bash -xv ClockTest.sh” to see the actual commands.

© Copyright 2014 by Bill Torpey. All Rights Reserved.

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

About

Code to test various clocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 33.0%
  • Java 32.8%
  • C 22.4%
  • Shell 11.8%