qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName) { QFile file(fileName); const bool openOk = file.open(QIODevice::ReadOnly | QIODevice::Text); Q_ASSERT(openOk); Q_UNUSED(openOk); qint64 val = -1; bool valSeen = false; QRegExp rxValue(QLatin1String("^summary: (\\d+)")); while (!file.atEnd()) { const QString line(QLatin1String(file.readLine())); if (rxValue.indexIn(line) != -1) { Q_ASSERT(rxValue.captureCount() == 1); bool ok; val = rxValue.cap(1).toLongLong(&ok); Q_ASSERT(ok); valSeen = true; break; } } if (!valSeen) qFatal("Failed to extract result"); return val; }
void CondorDatasource::readPendingDatagrams() { while (m_udpSocket.hasPendingDatagrams()) { QNetworkDatagram datagram = m_udpSocket.receiveDatagram(); QString data = QString::fromUtf8(datagram.data()); QStringList lines = data.split("\r\n"); for(QString line : lines) { QStringList splitLine = line.split("="); if(splitLine.length() == 2) { rxValue(splitLine[0], splitLine[1]); } } if(m_updatesReceived > 0) { setHelpText(QString("Received %1 value updates from Condor").arg(m_updatesReceived)); } } }