Specifications

CHAPTER 6. REQUIREMENTS VERIFICATION 59
The variable event jiffies of type unsigned long is initialized with a zero. To make
the variable accessible to other kernel drivers—the input device drivers—its symbol needs to
be exported. This is done with the macro EXPORT SYMBOL.
To measure t
2
, the input device drivers are required to store the current value of jiffies
into event jiffies once an input event occurs. To do so, the driver needs to include
include/jiffies.h and declare event jiffies as an external variable:
#include <linux/jiffies.h>
extern unsigned long event_jiffies;
While this code is common for all input device drivers for which t
2
should be determined,
the actual storage of the jiffies value highly depends on the device driver. Three different
drivers have been modified in order to measure t
2
:
AT and PS/2 keyboard driver (Chapter 2, §2.2)
ACPI button driver (Chapter 2, §2.6)
Toshiba ACPI driver (Chapter 2, §2.6)
The AT and PS/2 keyboard driver atkbd.c was modified in the following way: as soon
as the keyboard interrupt controller i8042 issues an interrupt, the interrupt handling routine
atkbd interrupt() of atkbd.c is invoked by the Linux kernel. This routine generates the
input event for the Linux input core by processing the data received from the keyboard. Right
before the actual input event is reported, the driver stores the actual value of jiffies to
event jiffies. To avoid the jiffies to be stored on every keypress, it previously checks if
the scancode of the pressed key was 0x57. This value corresponds to the key F11.
Regarding the ACPI button driver button.c, a similar modification was implemented.
Before the button driver invokes the ACPI bus drivers’ function acpi bus generate event()
to report that an ACPI button was pressed, the jiffies are stored to event jiffies. This
time, the value of event jiffies is stored whenever an ACPI button is pressed. No sp ecific
button is sorted out before saving the current jiffies.
The Toshiba ACPI driver’s function read keys() is executed once a pro cess is reading from
the driver’s user space interface /proc/acpi/toshiba/keys. This routine gathers data from
the system event register. If a function key was stored in the register, the jiffies are stored
into event jiffies correspondingly. This time, the jiffies are only stored if the function
key event was Fn-F1.
At this point, the device drivers are set up to store the first measuring point. The
second measuring point is set by the implemented kernel driver. The driver iallatency
(init/iallatency.c) exports two user space interfaces: /proc/ial event received and
/proc/ial get data. Once a process issues the system call open(2) on one of the two inter-
faces, a corresponding function of the driver is invoked. In the event that ial event received
is being accessed by a process, the current jiffies are stored to the variable receive jiffies
(type unsigned long). Thus, this is how the second measuring point is set: a user space ap-
plication is waiting for input events of the Input Abstraction Layer by utilizing its output
interface. As soon as an input event occurs, the application invokes the storage of the second
measuring point by issuing the following system call: