Originally Posted by
SixDegrees
Also, you should be sure you actually have a problem in the first place. How are you measuring CPU usage?
Are you seeing an actual slowdown in your application or in the system as a whole? If not, what is it youi're trying to improve?
yes, I'm 100% sure. I've several keyboard handlers in the app, and without this loop response to keypress is immediate, but when this loop is running I've like 1.5 sec delay.
I'm using standart gnome system monitor, and when this loop is active CPU load jumps to 100%, and after it stops it comes back to 0%.
Added after 53 minutes:
Seems I found a problem, may be it would help someone ...
I was using
this->port = new QextSerialPort(portName, QextSerialPort::EventDriven);
this->port = new QextSerialPort(portName, QextSerialPort::EventDriven);
To copy to clipboard, switch view to plain text mode
as it was suggested in included "PortListener" example. I switched to
this->port = new QextSerialPort(portName, QextSerialPort::Polling);
this->port = new QextSerialPort(portName, QextSerialPort::Polling);
To copy to clipboard, switch view to plain text mode
and CPU usage dropped to expected 2-3%.
I tested it on Ubuntu 10.10 (2.6.35-25-generic #44-Ubuntu SMP) and Debian 5.0.7 (2.6.29 with Vortex86DX patch)
p.s. Using QTimer member instead of static QTimer::singleShot doesn't give any noticable difference. And thanks to everyone who tried to help
Bookmarks