You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
app using 100% of 1 CPU, but not in wxTimer function #137
I have a wxPHP app which refreshes its window every minute.
(It is tailing an Apache log on another machine on the LAN,
and also checking that the WAN can see my server by bouncing a request off a remote web server.)
It seems to be using 100% of 1 of 4 CPU cores, that is, 25% of the CPU load as reported by LxTask,
or 99% of 1 core as reported by "top".
So I created a simple script:
<?php
$frame = new wxFrame(null, wxID_TOP, "Test");
$frame->Maximize();
$frame->Show();
$timer = new wxTimer();
$timer->Start(5000);
$timer->Connect(wxEVT_TIMER, array(wxID_TOP, "refresh"));
wxEntry();
function refresh()
{ $start = microtime(true);
// do nothing
$end = microtime(true);
print ($end - $start)." seconds\n";
}
?>
and that takes 2 - 4 microseconds, and 0% of CPU time, as expected.
So I put that into my app's refresh() function,
and it says it only spends 1.5 seconds inside the function every minute.
It would be OK if I was seeing a 1.5 second burst of activity every minute in LxTask, but I'm not.
Where could all that extra CPU time be going?
Any suggestions?
I have just discovered another of my wxPHP apps, that simply displays a table of mathematical and Greek letter symbols and copies them to the clipboard when clicked, is using 80% of one CPU in doing absolutely nothing except waiting for clicks. It is not related to whether its window is in xorg's visible rendering, but if the window is minimised (whether visible or not) the CPU usage goes to zero.
Activity
davekimble2 commentedon Jan 21, 2016
I have just discovered another of my wxPHP apps, that simply displays a table of mathematical and Greek letter symbols and copies them to the clipboard when clicked, is using 80% of one CPU in doing absolutely nothing except waiting for clicks. It is not related to whether its window is in xorg's visible rendering, but if the window is minimised (whether visible or not) the CPU usage goes to zero.
Lubuntu 14.04, so Openbox window manager.
jgmdev commentedon Jan 21, 2016
Thats strange, are your applications doing some kind of constant drawing?
davekimble2 commentedon Jan 21, 2016
No, but one that does doesn't show the same CPU usage, even when maximized.