On Sun, Mar 03, 2013 at 07:18:32AM -0500, Prarit Bhargava wrote:
Do we need this anymore, or can it be dropped to something more
reasonable like
HZ=100 or HZ=250?
Does anyone have an actual issue where they require HZ=1000?
Historically, one reason was that with 100HZ we wouldn't get frequent enough
timer interrupts that delays were accurate.
The test program below would consistently fail. That doesn't seem to be
the case against a current kernel afaict.
Dave
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
unsigned long do_time(unsigned long usecs)
{
struct timeval after, before;
int secs, usec;
gettimeofday(&before, NULL);
usleep(usecs);
gettimeofday(&after, NULL);
secs = after.tv_sec - before.tv_sec;
usec = after.tv_usec - before.tv_usec;
return secs * 1000000 + usec;
}
int main(int argc, char **argv)
{
unsigned long delays = 0;
int i;
/* take the average over 1000 measurements */
for (i = 0; i < 1000; i++)
delays += do_time(1000);
delays = delays / 1000;
printf("%li -> %li \n", 1000, delays);
/* we asked for a 1.000 msec delay, if this takes more than 2.5 msec that's
unacceptable. */
if (delays > 2500) {
printf("Unacceptable long delay; asked for 1000 usec, got %i usec
\n", delays);
exit(EXIT_FAILURE);
}
delays = 0;
for (i = 0; i < 1000; i++)
delays += do_time(2000);
delays = delays / 1000;
printf("%li -> %li \n", 2000, delays);
/* we asked for a 2.000 msec delay, if this takes more than 3.5 msec that's
unacceptable. */
if (delays > 3500) {
printf("Unacceptable long delay; asked for 2000 usec, got %i usec
\n", delays);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}