octave-maintainers
[Top][All Lists]
Advanced

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

Re: MXE/readline and event hook


From: Michael Goffioul
Subject: Re: MXE/readline and event hook
Date: Sun, 2 Jun 2013 18:00:04 -0400




On Sun, Jun 2, 2013 at 3:54 PM, John W. Eaton <address@hidden> wrote:
On 06/02/2013 02:33 PM, PhilipNienhuis wrote:

Interestingly, with an MXE-CLI w gnuplot as backend, CPU usage initially is
about 1-2%. When switching to fltk, it rises to 21-22 %. But after switching
back to gnuplot CPU usage remains at 21-22 %

I think that is because "graphics_toolkit gnuplot" prepares Octave to use gnuplot for plotting but doesn't remove the readline event hook function that "graphics_toolkit fltk" installed.


Maybe it's me but I find those idle CPU usages a bit high.

I agree that it is high.  I can't check at the moment, but I don't think it is that high when I use the GUI or the opengl+fltk graphics on my Debian system.

This is problem in readline that I encountered before when I "ported" it to be usable for octave. The issue is how readline is implementing event hook: it checks whether an input is available, mainly with "select", if not, it executes the hook function, then start again. Throttling the execution of the hook is done through the timeout value given to "select". It's set to 100ms, so the hook is only executed every 100ms, which keeps the CPU usage reasonably low.

Now the problem with Win32 platform is that you can only "select" on sockets, not file descriptor. So at best "select" returns immediately with an invalid argument error, or in my case HAVE_SELECT is not even defined (the configure check fails) and the "select" call is simply skipped. Hence the hook function keeps being executed without anything to throttle it, leading to high CPU usage.

I used to deal with that with a specific implementation in readline, but John didn't pick it up in his own set of patches.

Michael  


reply via email to

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