/* Pseudocode for modified low level interrupt handling routine */
do_IRQ ()
{
/* Modification to read the cycle counter as early as possible */
if   ( interrupt is 4 (serial port) and clock experiment active ) {
read TSC cycle counter and store in buffer;
increment buffer pointer;
}
/* Normal content of do_IRQ in Linux */
Call the specialized interrupt handler based on interrupt number;
/* Modification for transferring the results to user space */
if   ( clock experiment active and buffer is full ) {
check that the alternate buffer was read by the daemon;
switch to the alternate buffer;
signal the daemon to read the filled buffer;
}
}
Algorithm 1: Pseudocode for the modified main interrupt request handler, used to sample the cycle counter at every GPS pulse per second in the Linux kernel.