Web lists-archives.com

Re: The timerfd functions slow down emacs




On 2/23/2019 2:15 PM, Corinna Vinschen wrote:
> Below's the NSSTC I used to test my timerfd implementation (based on
> another STC to show a problem in POSIX timers).  From what I can tell it
> works as desired.  If you find a problem, please point it out or send a
> patch.

Thanks, that saved me a lot of time.  I was in the process of creating a test 
case when your mail arrived.

Your test works fine.  For example:

$ gcc timerfd_test.c -o timerfd_test

$ ./timerfd_test.exe 3 1 10
0.000: timer started 52379
2.988: 52379 read: 1; total=1
3.988: 52379 read: 1; total=2
4.989: 52379 read: 1; total=3
5.987: 52379 read: 1; total=4
7.001: 52379 read: 1; total=5
7.987: 52379 read: 1; total=6
9.001: 52379 read: 1; total=7
9.987: 52379 read: 1; total=8
10.987: 52379 read: 1; total=9
11.997: 52379 read: 1; total=10

But if I change CLOCK_MONOTONIC by CLOCK_REALTIME in the call to timerfd_create, 
then I get the following:

$ ./timerfd_test.exe 3 1 10
0.000: timer started 52385
0.006: 52385 read: 1550343072; total=1550343072

In particular, 'select' returns immediately.  In the case of emacs, BTW, timerfd 
is called like this:

   fd = timerfd_create (CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC);

Ken