Bug 1247405 - Track peak texture memory usage r=nical

This commit is contained in:
James Willcox 2016-02-10 15:03:32 -06:00
Родитель 38f9c3827b
Коммит ad3d8bc008
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -16,6 +16,7 @@ using namespace mozilla::gl;
NS_IMPL_ISUPPORTS(GfxTexturesReporter, nsIMemoryReporter)
Atomic<size_t> GfxTexturesReporter::sAmount(0);
Atomic<size_t> GfxTexturesReporter::sPeakAmount(0);
Atomic<size_t> GfxTexturesReporter::sTileWasteAmount(0);
/* static */ void
@ -26,6 +27,9 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
sAmount -= amount;
} else {
sAmount += amount;
if (sAmount > sPeakAmount) {
sPeakAmount = sAmount;
}
}
#ifdef MOZ_CRASHREPORTER

Просмотреть файл

@ -53,13 +53,18 @@ public:
MOZ_COLLECT_REPORT("gfx-tiles-waste", KIND_OTHER, UNITS_BYTES,
int64_t(sTileWasteAmount),
"Memory lost due to tiles extending past content boundaries");
return MOZ_COLLECT_REPORT(
MOZ_COLLECT_REPORT(
"gfx-textures", KIND_OTHER, UNITS_BYTES, int64_t(sAmount),
"Memory used for storing GL textures.");
MOZ_COLLECT_REPORT(
"gfx-textures-peak", KIND_OTHER, UNITS_BYTES, int64_t(sPeakAmount),
"Peak memory used for storing GL textures.");
return NS_OK;
}
private:
static Atomic<size_t> sAmount;
static Atomic<size_t> sPeakAmount;
// Count the amount of memory lost to tile waste
static Atomic<size_t> sTileWasteAmount;
};