mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
Replace DIA SDK COM-based PDB importer with RawPDB (MolecularMatters) which reads PDB files directly via memory-mapped I/O. Adds File menu "Import PDB..." dialog with type filtering, selection, and progress. - Vendor raw_pdb into third_party/ - Two-phase API: enumeratePdbTypes() + importPdbSelected() - Full recursive import of structs/unions/arrays/pointers/bitfields - PDB import dialog with name filter, select-all, type count - Benchmark: 1654 types from ntkrnlmp.pdb in 16ms - Reorganize import/export files into src/imports/
83 lines
2.5 KiB
C++
83 lines
2.5 KiB
C++
#include <QtTest/QtTest>
|
|
#include "core.h"
|
|
#include "imports/import_pdb.h"
|
|
|
|
using namespace rcx;
|
|
|
|
class BenchImportPdb : public QObject {
|
|
Q_OBJECT
|
|
private slots:
|
|
void benchEnumerateAll();
|
|
void benchImportAll();
|
|
};
|
|
|
|
static const QString kPdbPath = QStringLiteral(
|
|
"C:/Symbols/ntkrnlmp.pdb/0762CF42EF7F3E8116EF7329ADAA09A31/ntkrnlmp.pdb");
|
|
|
|
void BenchImportPdb::benchEnumerateAll() {
|
|
if (!QFile::exists(kPdbPath))
|
|
QSKIP("ntkrnlmp.pdb not found at expected path");
|
|
|
|
QString err;
|
|
QElapsedTimer timer;
|
|
timer.start();
|
|
QVector<PdbTypeInfo> types = enumeratePdbTypes(kPdbPath, &err);
|
|
qint64 elapsed = timer.elapsed();
|
|
|
|
QVERIFY2(!types.isEmpty(), qPrintable(err));
|
|
qDebug() << "enumeratePdbTypes:" << types.size() << "types in" << elapsed << "ms";
|
|
}
|
|
|
|
void BenchImportPdb::benchImportAll() {
|
|
if (!QFile::exists(kPdbPath))
|
|
QSKIP("ntkrnlmp.pdb not found at expected path");
|
|
|
|
// Phase 1: enumerate
|
|
QString err;
|
|
QElapsedTimer timer;
|
|
timer.start();
|
|
QVector<PdbTypeInfo> types = enumeratePdbTypes(kPdbPath, &err);
|
|
qint64 enumerateMs = timer.elapsed();
|
|
QVERIFY2(!types.isEmpty(), qPrintable(err));
|
|
|
|
// Collect all type indices
|
|
QVector<uint32_t> indices;
|
|
indices.reserve(types.size());
|
|
for (const auto& t : types)
|
|
indices.append(t.typeIndex);
|
|
|
|
// Phase 2: import all
|
|
timer.restart();
|
|
int lastProgress = 0;
|
|
NodeTree tree = importPdbSelected(kPdbPath, indices, &err,
|
|
[&](int cur, int total) -> bool {
|
|
// Report progress at 25% intervals
|
|
int pct = (cur * 100) / total;
|
|
if (pct >= lastProgress + 25) {
|
|
qDebug() << " progress:" << cur << "/" << total
|
|
<< "(" << pct << "%)";
|
|
lastProgress = pct;
|
|
}
|
|
return true;
|
|
});
|
|
qint64 importMs = timer.elapsed();
|
|
|
|
QVERIFY2(!tree.nodes.isEmpty(), qPrintable(err));
|
|
|
|
// Count root structs
|
|
int rootCount = 0;
|
|
for (const auto& n : tree.nodes)
|
|
if (n.parentId == 0 && n.kind == NodeKind::Struct) rootCount++;
|
|
|
|
qDebug() << "";
|
|
qDebug() << "=== PDB Import Benchmark (ntkrnlmp.pdb) ===";
|
|
qDebug() << " Enumerate:" << types.size() << "types in" << enumerateMs << "ms";
|
|
qDebug() << " Import all:" << rootCount << "root structs,"
|
|
<< tree.nodes.size() << "total nodes in" << importMs << "ms";
|
|
qDebug() << " Total:" << (enumerateMs + importMs) << "ms";
|
|
qDebug() << "============================================";
|
|
}
|
|
|
|
QTEST_MAIN(BenchImportPdb)
|
|
#include "bench_import_pdb.moc"
|