QtConcurrent::map uses 100% of CPU
-
It is up to the size of the "taskActivesByThread" and the time to get the response of the devices, it could be one minute or even more. The application works fine, but I just want to know if any other alternative methods would produce 100% of CPU while the polling is active...
-
Well, yesss..they are waiting for the results to be ready, but just because a thread is in an active state will produce a huge increment in the cpu?
-
It is thread safe...the snmp get is really a "QProcess" calling the libraries of the net-snmp, so i need the wait until the "QProcess" finish to captutre the data...
-
It's something like this...
@
QProcess snmpGet;
snmpGet.start(program,params);if (snmpGet.waitForStarted())
{
if (!snmpGet.waitForFinished())
{
return INVALID_VALUE;
}
QString output(snmpGet.readAll());
//Then i have to parsing the data to obtain the data...}else{
return INVALID_VALUE
}@
-
Profile it and see where the profiler says the cpu is spending all of its time.