MCPcopy Create free account
hub / github.com/Tencent/loli_profiler / LoadFromFile

Method LoadFromFile

src/mainwindow.cpp:428–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428int MainWindow::LoadFromFile(QFile *file) {
429 QDataStream stream(file);
430 quint32 magic;
431 stream >> magic;
432 if (magic != APP_MAGIC)
433 return static_cast<qint32>(IOErrorCode::MAGIC_NUMBER_MISSMATCH);
434 qint32 version;
435 stream >> version;
436 if (version != APP_VERSION)
437 return static_cast<qint32>(IOErrorCode::VERSION_MISSMATCH);
438 callStackModel_->clear();
439 // meminfo charts
440 qint32 value;
441 stream >> value;
442 maxMemInfoValue_ = value;
443 UpdateMemInfoRange();
444 qint32 seriesCount;
445 stream >> seriesCount;
446 for (auto series : memInfoSeries_)
447 series->clear();
448 for (int i = 0 ;i < seriesCount; i++) {
449 int pointsCount;
450 stream >> pointsCount;
451 for (int j = 0; j < pointsCount; j++) {
452 QPointF point;
453 stream >> point;
454 memInfoSeries_[i]->append(point);
455 }
456 }
457 // string hashes
458 HashString::hashmap_.clear();
459 stream >> HashString::hashmap_;
460 // callstack tree view
461 QSet<QString> libraries;
462 filteredStacktraceModel_->clear();
463 stacktraceModel_->clear();
464 ResetFilters();
465 SwitchStackTraceModel(stacktraceProxyModel_);
466 stream >> value;
467 QVector<StackRecord> records;
468 records.reserve(value);
469 for (int i = 0; i < value; i++) {
470 StackRecord record;
471 QString str;
472 stream >> str;
473 record.uuid_ = QUuid::fromString(str);
474 stream >> record.seq_;
475 stream >> record.time_;
476 stream >> record.size_;
477 stream >> record.addr_;
478 stream >> record.funcAddr_;
479 stream >> record.library_.hashcode_;
480 if (!libraries.contains(record.library_.Get()))
481 libraries.insert(record.library_.Get());
482 records.push_back(record);
483 }
484 ui->recordCountLineEdit->setText("");
485 ui->libraryComboBox->setCurrentIndex(0);

Callers

nothing calls this directly

Calls 6

SMapsSectionAddrClass · 0.85
GetMethod · 0.80
setTextMethod · 0.80
countMethod · 0.80
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected