Bug 1030487 - Don't report main-thread I/O to Telemetry unless it lasts more than 50ms; r=vladan

This commit is contained in:
Rafael Kourdis
2014-08-18 18:42:14 -04:00
parent 637f53a031
commit 064a8327d2
2 changed files with 9 additions and 1 deletions

View File

@@ -411,6 +411,9 @@ void TelemetryIOInterposeObserver::AddPath(const nsAString& aPath,
mSafeDirs.AppendElement(SafeDir(aPath, aSubstName)); mSafeDirs.AppendElement(SafeDir(aPath, aSubstName));
} }
// Threshold for reporting slow main-thread I/O (50 milliseconds).
const TimeDuration kTelemetryReportThreshold = TimeDuration::FromMilliseconds(50);
void TelemetryIOInterposeObserver::Observe(Observation& aOb) void TelemetryIOInterposeObserver::Observe(Observation& aOb)
{ {
// We only report main-thread I/O // We only report main-thread I/O
@@ -424,6 +427,10 @@ void TelemetryIOInterposeObserver::Observe(Observation& aOb)
return; return;
} }
if (aOb.Duration() < kTelemetryReportThreshold) {
return;
}
// Get the filename // Get the filename
const char16_t* filename = aOb.Filename(); const char16_t* filename = aOb.Filename();

View File

@@ -350,6 +350,7 @@ public:
"IOInterposer", false) "IOInterposer", false)
{ {
mStart = TimeStamp::Now(); mStart = TimeStamp::Now();
mEnd = mStart;
} }
}; };