static int hello_init(void)
{
int i;
int *lat;
printk(KERN_ALERT "INIT\n");
lat = kmalloc(MAX * sizeof *lat, GFP_KERNEL);
if (lat == NULL) return -1;
for (i=0; i < MAX; ++i) lat[i] = 0;
for (i=0; i < 5; ++i) foo();
for (i=0; i < N; ++i)
{
unsigned count, res;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
foo();
local_irq_disable();
count = foo();
local_irq_enable();
res = count >> 8;
if (res < MAX) ++lat[res]; else printk(KERN_ALERT "OUT OF RANGE\n");
}
for (i=0; i < MAX; ++i)
if (lat[i] != 0) printk(KERN_ALERT "%d %d\n", i<<8, lat[i]);
return 0;
}