QTimer at 50Hz on Linux - High CPU Usage
Hello,
I am using QT 5.8
On Windows I have no ploblems.
On Fedora 25 Using a qTimer set at 50 hz, the CPU usage rises to 90%.
If I reduce the frequency of the qTimer the CPU usage decreases considerably.
Code:
QTimer* m_timer;
// in file .h
// in file .cpp
int interval = (1 / 50) * 1000;
m_timer->start(interval);
connect(m_timer SIGNAL(timeout()),
this, SLOT(slotRead()));
Can you give me some suggestions?
Thanks in advance!
Best Regards!
Re: QTimer at 50Hz on Linux - High CPU Usage
Quote:
Originally Posted by
Elisabetta
Code:
int interval = (1 / 50) * 1000;
Hi, "interval" here becomes zero because 1/50 is done using integers. This is probably not what you want (or not what you actually do...).
Ginsengelf