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) {
|
if (event.startsWith('r') && event.length() == 4) {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const uint eventNumber = event.midRef(1).toUInt(&ok, 16);
|
const uint eventNumber = QStringView{event}.mid(1).toUInt(&ok, 16);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
description.eventType = EventTypeRaw;
|
description.eventType = EventTypeRaw;
|
||||||
description.numericEvent = eventNumber;
|
description.numericEvent = eventNumber;
|
||||||
|
@@ -179,8 +179,8 @@ QVariantMap PerfTimelineModel::details(int index) const
|
|||||||
result.insert(tr("Name"), orUnknown(manager->string(tracePoint.name)));
|
result.insert(tr("Name"), orUnknown(manager->string(tracePoint.name)));
|
||||||
const QHash<qint32, QVariant> &extraData = m_extraData[index];
|
const QHash<qint32, QVariant> &extraData = m_extraData[index];
|
||||||
for (auto it = extraData.constBegin(), end = extraData.constEnd(); it != end; ++it) {
|
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()));
|
prettyPrintTraceData(it.value()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_resourceBlocks.isEmpty()) {
|
if (!m_resourceBlocks.isEmpty()) {
|
||||||
|
@@ -112,19 +112,20 @@ void PerfResourceCounterTest::testMallocFree()
|
|||||||
|
|
||||||
void PerfResourceCounterTest::testRandomFill()
|
void PerfResourceCounterTest::testRandomFill()
|
||||||
{
|
{
|
||||||
|
auto rg = QRandomGenerator::global();
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
SizeCounter::Container container;
|
SizeCounter::Container container;
|
||||||
SizeCounter counter(&container);
|
SizeCounter counter(&container);
|
||||||
for (int i = 0; i < 10000; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
const int amount = qrand();
|
const int amount = rg->generate();
|
||||||
counter.request(amount, i);
|
counter.request(amount, i);
|
||||||
counter.obtain(qrand());
|
counter.obtain(rg->generate());
|
||||||
if (sum(container) != counter.currentTotal())
|
if (sum(container) != counter.currentTotal())
|
||||||
qDebug() << "ouch";
|
qDebug() << "ouch";
|
||||||
QCOMPARE(sum(container), counter.currentTotal());
|
QCOMPARE(sum(container), counter.currentTotal());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 10000; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
counter.release(qrand());
|
counter.release(rg->generate());
|
||||||
QCOMPARE(sum(container), counter.currentTotal());
|
QCOMPARE(sum(container), counter.currentTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,9 +139,10 @@ void PerfResourceCounterTest::testUnitSized()
|
|||||||
NoPayloadCounter::Container container;
|
NoPayloadCounter::Container container;
|
||||||
NoPayloadCounter counter(&container);
|
NoPayloadCounter counter(&container);
|
||||||
QList<int> ids;
|
QList<int> ids;
|
||||||
|
auto rg = QRandomGenerator::global();
|
||||||
for (int i = 0; i < 10000; ++i) {
|
for (int i = 0; i < 10000; ++i) {
|
||||||
counter.request(1);
|
counter.request(1);
|
||||||
const int id = qrand();
|
const int id = rg->generate();
|
||||||
counter.obtain(id);
|
counter.obtain(id);
|
||||||
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
|
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
|
||||||
ids.append(id);
|
ids.append(id);
|
||||||
@@ -158,11 +160,12 @@ void PerfResourceCounterTest::testRandomAlternate()
|
|||||||
{
|
{
|
||||||
NoPayloadCounter::Container container;
|
NoPayloadCounter::Container container;
|
||||||
NoPayloadCounter counter(&container);
|
NoPayloadCounter counter(&container);
|
||||||
|
auto rg = QRandomGenerator::global();
|
||||||
for (int i = 0; i < 1000; ++i) {
|
for (int i = 0; i < 1000; ++i) {
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
counter.request(qrand());
|
counter.request(rg->generate());
|
||||||
counter.obtain(qrand());
|
counter.obtain(rg->generate());
|
||||||
counter.release(qrand());
|
counter.release(rg->generate());
|
||||||
}
|
}
|
||||||
QCOMPARE(sum(container), counter.currentTotal());
|
QCOMPARE(sum(container), counter.currentTotal());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user