Commit ace917bd authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 9eb71b9c
2012-10-01 Eli Zaretskii <eliz@gnu.org>
* w32proc.c (timer_loop): Fix code that waits for timer
expiration, to avoid high CPU usage.
2012-10-01 Stefan Monnier <monnier@iro.umontreal.ca>
* fns.c (check_hash_table, get_key_arg, maybe_resize_hash_table)
......
......@@ -333,11 +333,11 @@ timer_loop (LPVOID arg)
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment