Bug 1245612 - Send texture usage bytes in crash reports r=bsmedberg

This commit is contained in:
James Willcox 2016-02-03 14:24:47 -06:00
parent caf91815f5
commit 7a9c161c34
3 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,10 @@
#include "GfxTexturesReporter.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
using namespace mozilla::gl;
@ -23,4 +27,8 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
} else {
sAmount += amount;
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateTexturesSize(sAmount);
#endif
}

View File

@ -469,6 +469,13 @@ void AnnotateOOMAllocationSize(size_t size)
gOOMAllocationSize = size;
}
static size_t gTexturesSize = 0;
void AnnotateTexturesSize(size_t size)
{
gTexturesSize = size;
}
#ifndef XP_WIN
// Like Windows CopyFile for *nix
bool copy_file(const char* from, const char* to)
@ -716,6 +723,11 @@ bool MinidumpCallback(
XP_STOA(gOOMAllocationSize, oomAllocationSizeBuffer, 10);
}
char texturesSizeBuffer[32] = "";
if (gTexturesSize) {
XP_STOA(gTexturesSize, texturesSizeBuffer, 10);
}
// calculate time since last crash (if possible), and store
// the time of this crash.
time_t crashTime;
@ -861,6 +873,11 @@ bool MinidumpCallback(
WriteAnnotation(eventFile, "OOMAllocationSize", oomAllocationSizeBuffer);
}
if (texturesSizeBuffer[0]) {
WriteAnnotation(apiData, "TextureUsage", texturesSizeBuffer);
WriteAnnotation(eventFile, "TextureUsage", texturesSizeBuffer);
}
if (memoryReportPath) {
WriteLiteral(apiData, "ContainsMemoryReport=1\n");
WriteLiteral(eventFile, "ContainsMemoryReport=1\n");

View File

@ -78,6 +78,8 @@ void AnnotateOOMAllocationSize(size_t size);
nsresult SetGarbageCollecting(bool collecting);
void SetEventloopNestingLevel(uint32_t level);
void AnnotateTexturesSize(size_t size);
nsresult SetRestartArgs(int argc, char** argv);
nsresult SetupExtraData(nsIFile* aAppDataDirectory,
const nsACString& aBuildID);