emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110327: Fix high CPU usage in profil


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110327: Fix high CPU usage in profiling on MS-Windows.
Date: Mon, 01 Oct 2012 23:09:30 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110327
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2012-10-01 23:09:30 +0200
message:
  Fix high CPU usage in profiling on MS-Windows.
  
   src/w32proc.c (timer_loop): Fix code that waits for timer
   expiration, to avoid high CPU usage.
modified:
  src/ChangeLog
  src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-01 18:59:52 +0000
+++ b/src/ChangeLog     2012-10-01 21:09:30 +0000
@@ -1,3 +1,8 @@
+2012-10-01  Eli Zaretskii  <address@hidden>
+
+       * w32proc.c (timer_loop): Fix code that waits for timer
+       expiration, to avoid high CPU usage.
+
 2012-10-01  Stefan Monnier  <address@hidden>
 
        * fns.c (check_hash_table, get_key_arg, maybe_resize_hash_table)

=== modified file 'src/w32proc.c'
--- a/src/w32proc.c     2012-10-01 09:59:53 +0000
+++ b/src/w32proc.c     2012-10-01 21:09:30 +0000
@@ -333,11 +333,11 @@
          Sleep (sleep_time * 1000 / CLOCKS_PER_SEC);
          /* Always sleep past the expiration time, to make sure we
             never call the handler _before_ the expiration time,
-            always slightly after it.  Sleep(0) relinquishes the rest
-            of the scheduled slot, so that we let other threads
-            work.  */
+            always slightly after it.  Sleep(5) makes sure we don't
+            hog the CPU by calling 'clock' with high frequency, and
+            also let other threads work.  */
          while (clock () < expire)
-           Sleep (0);
+           Sleep (5);
        }
 
       if (itimer->expire == 0)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]