unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* alarm_signal_handler is called too frequently
@ 2004-10-13  1:15 YAMAMOTO Mitsuharu
  2004-10-13 14:43 ` Richard Stallman
  0 siblings, 1 reply; 25+ messages in thread
From: YAMAMOTO Mitsuharu @ 2004-10-13  1:15 UTC (permalink / raw)


I noticed that alarm_signal_handler was called too frequently on the
system that used polling with SIGALRM (such as Solaris/X11 and Mac OS
X/Carbon).  In alarm_signal_handler, set_alarm is called even when
interrupt_input_blocked is non-zero where no timer function is
executed.  If BLOCK_INPUT continues for a long time, which is typical
in Mac OS X/Carbon, set_alarm will set the timer value to 1000 usec
because the current time (now) exceeds the old expiration time
(atimers->expiration).  I think we don't have to call set_alarm when
pending_atimers is non-zero because do_pending_atimers is supposed to
be called eventually in such a case.  Is that correct?

The following patch also apparently reduces the CPU usage during the
idle time (~1.0% -> 0.0% on my PowerBook G4 667MHz).

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/atimer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/atimer.c,v
retrieving revision 1.16
diff -c -r1.16 atimer.c
*** src/atimer.c	19 Jul 2004 04:42:43 -0000	1.16
--- src/atimer.c	13 Oct 2004 00:56:47 -0000
***************
*** 397,403 ****
        EMACS_GET_TIME (now);
      }
  
!   set_alarm ();
  }
  
  
--- 397,404 ----
        EMACS_GET_TIME (now);
      }
  
!   if (!pending_atimers)
!     set_alarm ();
  }

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

end of thread, other threads:[~2004-11-06  5:22 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-13  1:15 alarm_signal_handler is called too frequently YAMAMOTO Mitsuharu
2004-10-13 14:43 ` Richard Stallman
2004-10-14  5:16   ` YAMAMOTO Mitsuharu
2004-10-17  9:36     ` YAMAMOTO Mitsuharu
2004-10-25 13:13       ` Richard Stallman
2004-10-25 14:38         ` Jan D.
2004-10-27 10:47           ` Richard Stallman
2004-10-28 18:02             ` Jan D.
2004-10-29  1:37               ` YAMAMOTO Mitsuharu
2004-10-29  7:00                 ` Jan D.
2004-10-29  8:24                   ` YAMAMOTO Mitsuharu
2004-11-01  7:24                   ` Richard Stallman
2004-11-01  9:06                     ` Jan D.
2004-11-01 12:21                       ` Jan D.
2004-11-02 14:08                       ` Richard Stallman
2004-11-02 21:56                         ` Jan D.
2004-11-03 17:04                           ` Richard Stallman
2004-11-03 17:26                             ` Jan D.
2004-11-04 20:42                               ` Richard Stallman
2004-11-04 22:41                             ` Jan D.
2004-11-05 12:36                               ` Kim F. Storm
2004-11-06  5:22                                 ` Richard Stallman
2004-11-04 13:02                         ` Jan D.
2004-10-31  9:42               ` Richard Stallman
2004-10-31 15:11                 ` Jan D.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).