mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[Oracle/Tests] Measure parse against post-fixture baseline; assert release empties sets
This commit is contained in:
parent
7d8514ec34
commit
34d96d9fe5
1 changed files with 16 additions and 3 deletions
|
|
@ -353,8 +353,9 @@ static void logRamPhase(const QString &phase, const MemorySnapshot &baseline, co
|
||||||
// VmHWM / ru_maxrss are monotonically non-decreasing high-water marks, so a
|
// VmHWM / ru_maxrss are monotonically non-decreasing high-water marks, so a
|
||||||
// peak-based delta between phases is ~0.0 MB by construction once the
|
// peak-based delta between phases is ~0.0 MB by construction once the
|
||||||
// fixture build has set the process peak. The live signals are current RSS
|
// fixture build has set the process peak. The live signals are current RSS
|
||||||
// and the process peak; the delta is only meaningful where current RSS is
|
// and the process peak; the delta is meaningful only where the baseline was
|
||||||
// a per-phase value (see "after releaseSetData()").
|
// taken immediately before the phase it measures (e.g. the import phase,
|
||||||
|
// which compares afterParse against afterImport).
|
||||||
QString rssDelta = "N/A";
|
QString rssDelta = "N/A";
|
||||||
if (current.rssKb >= 0 && baseline.rssKb >= 0) {
|
if (current.rssKb >= 0 && baseline.rssKb >= 0) {
|
||||||
rssDelta = formatKb(current.rssKb - baseline.rssKb);
|
rssDelta = formatKb(current.rssKb - baseline.rssKb);
|
||||||
|
|
@ -435,6 +436,13 @@ TEST(OracleBenchmark, ImportRamUsage)
|
||||||
|
|
||||||
const QByteArray data = buildSyntheticData(numSets, cardsPerSet);
|
const QByteArray data = buildSyntheticData(numSets, cardsPerSet);
|
||||||
|
|
||||||
|
// The fixture build leaves freed-but-unreturned arenas behind (current RSS
|
||||||
|
// rarely falls once glibc allocates). Baseline immediately after it so the
|
||||||
|
// parse phase measures only the importer's own growth (~40 MB) rather than
|
||||||
|
// swallowing the fixture builder's spike.
|
||||||
|
const MemorySnapshot afterFixture = MemorySnapshot::current();
|
||||||
|
logRamPhase("fixture build", baseline, afterFixture);
|
||||||
|
|
||||||
NoopCardSetPriorityController controller;
|
NoopCardSetPriorityController controller;
|
||||||
OracleImporter importer;
|
OracleImporter importer;
|
||||||
|
|
||||||
|
|
@ -459,9 +467,14 @@ TEST(OracleBenchmark, ImportRamUsage)
|
||||||
.arg(data.size() / (1024.0 * 1024.0), 0, 'f', 1);
|
.arg(data.size() / (1024.0 * 1024.0), 0, 'f', 1);
|
||||||
qDebug().noquote() << QString(" JSON parse: %1 ms").arg(parseMs);
|
qDebug().noquote() << QString(" JSON parse: %1 ms").arg(parseMs);
|
||||||
qDebug().noquote() << QString(" Card import: %1 ms").arg(importMs);
|
qDebug().noquote() << QString(" Card import: %1 ms").arg(importMs);
|
||||||
logRamPhase("parse", baseline, afterParse);
|
logRamPhase("parse", afterFixture, afterParse);
|
||||||
logRamPhase("import", afterParse, afterImport);
|
logRamPhase("import", afterParse, afterImport);
|
||||||
logRamPhase("after releaseSetData()", afterImport, afterRelease);
|
logRamPhase("after releaseSetData()", afterImport, afterRelease);
|
||||||
|
|
||||||
|
// Freeing the parsed tree rarely moves current RSS (allocator reuse), so the
|
||||||
|
// meaningful signal that release actually dropped the buffers is emptiness,
|
||||||
|
// not an RSS delta.
|
||||||
|
ASSERT_TRUE(importer.getSets().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OracleBenchmark, ImportRamUsageAllPrintings)
|
TEST(OracleBenchmark, ImportRamUsageAllPrintings)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue