linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Strange results with changing HZ
@ 2005-11-21  7:44 Wojciech Kromer
  2005-11-21 11:43 ` David Jander
  0 siblings, 1 reply; 3+ messages in thread
From: Wojciech Kromer @ 2005-11-21  7:44 UTC (permalink / raw)
  To: linuxppc-embedded

My system is:
 - 2.4.25 kernel from denx.de
 - uclibc (gcc 3.4.2) + busybox
 - changed HZ to 1000
 - rebuild kernel only

AFAIR there souldn't be any need to recompile user apps.

I have strange results.
Sleep and timeout selects works fine, but alarm functions seems to be 
too fast.
For example included program or ping waits too short.



it is OK:

# time alarm_test
alarm fired after 0.099166s
real    0m 0.11s
user    0m 0.00s
sys     0m 0.00s
#
# time sleep 1
real    0m 1.01s
user    0m 0.00s
sys     0m 0.00s
# time sleep 10
real    0m 10.01s
user    0m 0.00s
sys     0m 0.00s


but:

# alarm_test
alarm fired after 0.099709s
# alarm_test
alarm fired after 0.099710s


------------------------------------ alarm_test.c :

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>

static void sighand(int sig)
{
}

int main()
{
 struct timeval tv1, tv2;
 sigset_t set;

 sigfillset(&set);
 sigdelset(&set, SIGALRM);
 sigdelset(&set, SIGINT);

 signal(SIGALRM, sighand);
 gettimeofday(&tv1, NULL);

 alarm(1);
 sigsuspend(&set);
 gettimeofday(&tv2, NULL);

 tv1.tv_sec = tv2.tv_sec - tv1.tv_sec - (tv2.tv_usec < tv1.tv_usec);
 tv1.tv_usec = tv2.tv_usec - tv1.tv_usec + (tv2.tv_usec < tv1.tv_usec) * 
1000000;

 printf("alarm fired after %ld.%06lds\n",
 tv1.tv_sec, tv1.tv_usec);

 return 0;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Strange results with changing HZ
  2005-11-21  7:44 Strange results with changing HZ Wojciech Kromer
@ 2005-11-21 11:43 ` David Jander
  2005-12-09 10:33   ` Wojciech Kromer
  0 siblings, 1 reply; 3+ messages in thread
From: David Jander @ 2005-11-21 11:43 UTC (permalink / raw)
  To: linuxppc-embedded

On Monday 21 November 2005 08:44, Wojciech Kromer wrote:
> My system is:
>  - 2.4.25 kernel from denx.de
>  - uclibc (gcc 3.4.2) + busybox
>  - changed HZ to 1000
>  - rebuild kernel only
>
> AFAIR there souldn't be any need to recompile user apps.

Just an uneducated guess, but are you sure uclibc doesn't depend on HZ at all?
Some things might be just straight syscalls, others might be implemented in 
userspace (inside uclibc)... for example alarm(1) programming an alarm on 
jiffies+1/HZ, and HZ being compiled in from kernel headers ?
I may just be talking rubbish though.

Greetings,

-- 
David Jander

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Strange results with changing HZ
  2005-11-21 11:43 ` David Jander
@ 2005-12-09 10:33   ` Wojciech Kromer
  0 siblings, 0 replies; 3+ messages in thread
From: Wojciech Kromer @ 2005-12-09 10:33 UTC (permalink / raw)
  To: linuxppc-embedded

Dnia 2005-11-21 12:43, Użytkownik David Jander napisał:

>On Monday 21 November 2005 08:44, Wojciech Kromer wrote:
>  
>
>>My system is:
>> - 2.4.25 kernel from denx.de
>> - uclibc (gcc 3.4.2) + busybox
>> - changed HZ to 1000
>> - rebuild kernel only
>>
>>AFAIR there souldn't be any need to recompile user apps.
>>    
>>
>
>Just an uneducated guess, but are you sure uclibc doesn't depend on HZ at all?
>Some things might be just straight syscalls, others might be implemented in 
>userspace (inside uclibc)... for example alarm(1) programming an alarm on 
>jiffies+1/HZ, and HZ being compiled in from kernel headers ?
>I may just be talking rubbish though.
>  
>

Hmm, after recompiling whole uclibc stuff it seem to work same.
There should be kernel problem. Sleep & select works fine, but alarm 
works 10 times faster.

Anyone tries to change HZ to 1000?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-09 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-21  7:44 Strange results with changing HZ Wojciech Kromer
2005-11-21 11:43 ` David Jander
2005-12-09 10:33   ` Wojciech Kromer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).