зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1118686 - TraceLogger: Cap the maximum number of entries in the graph tree, r=bbouvier
This commit is contained in:
Родитель
110cba0490
Коммит
5bcc5a9cfa
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче