Bug 717698. Add about:jank infrastructure. r=ehsan

Adds a profiling mode that only records samples when we
haven't spun the event loop
This commit is contained in:
Jeff Muizelaar 2011-12-20 15:13:52 -05:00
Родитель 9b494f57e9
Коммит dba7c91301
1 изменённых файлов: 25 добавлений и 9 удалений

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

@ -245,6 +245,7 @@ class TableTicker: public Sampler {
{ {
mUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk"); mUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk");
mProfile.addTag(ProfileEntry('m', "Start")); mProfile.addTag(ProfileEntry('m', "Start"));
mJankOnly = hasFeature(aFeatures, aFeatureCount, "jank");
} }
~TableTicker() { if (IsActive()) Stop(); } ~TableTicker() { if (IsActive()) Stop(); }
@ -276,6 +277,7 @@ class TableTicker: public Sampler {
Stack *mStack; Stack *mStack;
bool mSaveRequested; bool mSaveRequested;
bool mUseStackWalk; bool mUseStackWalk;
bool mJankOnly;
}; };
/** /**
@ -380,17 +382,31 @@ void TableTicker::Tick(TickSample* sample)
} }
mStack->mQueueClearMarker = true; mStack->mQueueClearMarker = true;
#ifdef USE_BACKTRACE bool recordSample = true;
if (mUseStackWalk) { if (mJankOnly) {
doBacktrace(mProfile); recordSample = false;
} else { // only record the events when we have a we haven't seen a tracer event for 100ms
doSampleStackTrace(mStack, mProfile, sample); if (!sLastTracerEvent.IsNull()) {
TimeDuration delta = sample->timestamp - sLastTracerEvent;
if (delta.ToMilliseconds() > 100.0) {
recordSample = true;
}
}
} }
#else
doSampleStackTrace(mStack, mProfile, sample);
#endif
if (!sLastTracerEvent.IsNull() && sample) { if (recordSample) {
#ifdef USE_BACKTRACE
if (mUseStackWalk) {
doBacktrace(mProfile);
} else {
doSampleStackTrace(mStack, mProfile, sample);
}
#else
doSampleStackTrace(mStack, mProfile, sample);
#endif
}
if (!mJankOnly && !sLastTracerEvent.IsNull() && sample) {
TimeDuration delta = sample->timestamp - sLastTracerEvent; TimeDuration delta = sample->timestamp - sLastTracerEvent;
mProfile.addTag(ProfileEntry('r', delta.ToMilliseconds())); mProfile.addTag(ProfileEntry('r', delta.ToMilliseconds()));
} }