[Top][All Lists]

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

Re: Elisp native profiler

From: Eli Zaretskii
Subject: Re: Elisp native profiler
Date: Tue, 02 Oct 2012 19:20:37 +0200

> From: Jason Rumney <address@hidden>
> Cc: Paul Eggert <address@hidden>,  address@hidden,  address@hidden,  
> address@hidden
> Date: Tue, 02 Oct 2012 21:23:15 +0800
> Eli Zaretskii <address@hidden> writes:
> > I think this is because with the minimal sampling period I allow, the
> > timer thread almost never sleeps
> If it works as you say, it should be spending most  of the time asleep. I
> think the problem is more likely to be the sampling rate of the CPU
> monitor - Windows built in CPU monitor is known to vastly overestimate
> the CPU use of a thread that is frequently waking at regular intervals
> like that.

Well, as you saw by now, you should never attribute to OS misfeatures
what can be easily attributed to bugs in the application ;-)

The problem was my incorrect interpretation of what 'Sleep (0);' does
in terms of timing.  The documentation says it causes the thread to
relinquish the remainder of its time slice, but I apparently didn't
realize how short that slice is.  Therefore the loop

  while (clock () < expiration_time)
    Sleep (0);

which was meant to make sure we never fire SIGPROF before the
expiration time, pegged one core because it called 'clock' too
frequently.  Changing 0 to 5 made the trick.

reply via email to

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