forked from qt-creator/qt-creator
PerfProfiler: Some Qt6 compilation
Remaining issues operator<<(DataStream &...), the timeline dependency and qmlRegisterType. Change-Id: I51556e67cd93cb8bdced569ca509929705da80b4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -355,7 +355,7 @@ PerfConfigEventsModel::EventDescription PerfConfigEventsModel::parseEvent(
|
||||
|
||||
if (event.startsWith('r') && event.length() == 4) {
|
||||
bool ok = false;
|
||||
const uint eventNumber = event.midRef(1).toUInt(&ok, 16);
|
||||
const uint eventNumber = QStringView{event}.mid(1).toUInt(&ok, 16);
|
||||
if (ok) {
|
||||
description.eventType = EventTypeRaw;
|
||||
description.numericEvent = eventNumber;
|
||||
|
@@ -179,7 +179,7 @@ QVariantMap PerfTimelineModel::details(int index) const
|
||||
result.insert(tr("Name"), orUnknown(manager->string(tracePoint.name)));
|
||||
const QHash<qint32, QVariant> &extraData = m_extraData[index];
|
||||
for (auto it = extraData.constBegin(), end = extraData.constEnd(); it != end; ++it) {
|
||||
result.insertMulti(QString::fromUtf8(manager->string(it.key())),
|
||||
result.insert(QString::fromUtf8(manager->string(it.key())),
|
||||
prettyPrintTraceData(it.value()));
|
||||
}
|
||||
}
|
||||
|
@@ -112,19 +112,20 @@ void PerfResourceCounterTest::testMallocFree()
|
||||
|
||||
void PerfResourceCounterTest::testRandomFill()
|
||||
{
|
||||
auto rg = QRandomGenerator::global();
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
SizeCounter::Container container;
|
||||
SizeCounter counter(&container);
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
const int amount = qrand();
|
||||
const int amount = rg->generate();
|
||||
counter.request(amount, i);
|
||||
counter.obtain(qrand());
|
||||
counter.obtain(rg->generate());
|
||||
if (sum(container) != counter.currentTotal())
|
||||
qDebug() << "ouch";
|
||||
QCOMPARE(sum(container), counter.currentTotal());
|
||||
}
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
counter.release(qrand());
|
||||
counter.release(rg->generate());
|
||||
QCOMPARE(sum(container), counter.currentTotal());
|
||||
}
|
||||
|
||||
@@ -138,9 +139,10 @@ void PerfResourceCounterTest::testUnitSized()
|
||||
NoPayloadCounter::Container container;
|
||||
NoPayloadCounter counter(&container);
|
||||
QList<int> ids;
|
||||
auto rg = QRandomGenerator::global();
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
counter.request(1);
|
||||
const int id = qrand();
|
||||
const int id = rg->generate();
|
||||
counter.obtain(id);
|
||||
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
|
||||
ids.append(id);
|
||||
@@ -158,11 +160,12 @@ void PerfResourceCounterTest::testRandomAlternate()
|
||||
{
|
||||
NoPayloadCounter::Container container;
|
||||
NoPayloadCounter counter(&container);
|
||||
auto rg = QRandomGenerator::global();
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
counter.request(qrand());
|
||||
counter.obtain(qrand());
|
||||
counter.release(qrand());
|
||||
counter.request(rg->generate());
|
||||
counter.obtain(rg->generate());
|
||||
counter.release(rg->generate());
|
||||
}
|
||||
QCOMPARE(sum(container), counter.currentTotal());
|
||||
}
|
||||
|
Reference in New Issue
Block a user