Bug 1118686 - TraceLogger: Cap the maximum number of entries in the graph tree, r=bbouvier

This commit is contained in:
Hannes Verschore 2015-01-13 13:37:27 +01:00
Родитель 110cba0490
Коммит 5bcc5a9cfa
2 изменённых файлов: 6 добавлений и 1 удалений

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

@ -284,7 +284,7 @@ TraceLoggerGraph::startEvent(uint32_t id, uint64_t timestamp)
return;
if (!tree.hasSpaceForAdd()) {
if (!tree.ensureSpaceBeforeAdd()) {
if (tree.size() >= treeSizeFlushLimit() || !tree.ensureSpaceBeforeAdd()) {
if (!flush()) {
fprintf(stderr, "TraceLogging: Couldn't write the data to disk.\n");
enabled = 0;

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

@ -202,6 +202,11 @@ class TraceLoggerGraph
// Create a tree out of all the given events.
void log(ContinuousSpace<EventEntry> &events);
static size_t treeSizeFlushLimit() {
// Allow tree size to grow to 100MB.
return 100 * 1024 * 1024 / sizeof(TreeEntry);
}
private:
bool failed;
bool enabled;