зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1843534 - Avoid taking unnecessary timestamps when thread is not being profiled for markers. r=julienw
As taking timestamps can be expensive on certain devices we should try to avoid taking them where possible. This patch fixes a few occasions where we take a timestamp solely for a profiler marker even when the current thread is not being profiled. Differential Revision: https://phabricator.services.mozilla.com/D185008
This commit is contained in:
Родитель
0907d63767
Коммит
a1284686b2
|
@ -19,7 +19,6 @@ class MOZ_RAII AutoProfilerStyleMarker {
|
|||
explicit AutoProfilerStyleMarker(UniquePtr<ProfileChunkedBuffer> aCause,
|
||||
const Maybe<uint64_t>& aInnerWindowID)
|
||||
: mActive(profiler_thread_is_being_profiled_for_markers()),
|
||||
mStartTime(TimeStamp::Now()),
|
||||
mCause(std::move(aCause)),
|
||||
mInnerWindowID(aInnerWindowID) {
|
||||
if (!mActive) {
|
||||
|
@ -29,6 +28,8 @@ class MOZ_RAII AutoProfilerStyleMarker {
|
|||
"Nested AutoProfilerStyleMarker");
|
||||
ServoTraversalStatistics::sSingleton = ServoTraversalStatistics();
|
||||
ServoTraversalStatistics::sActive = true;
|
||||
|
||||
mStartTime = TimeStamp::Now();
|
||||
}
|
||||
|
||||
~AutoProfilerStyleMarker() {
|
||||
|
|
|
@ -260,6 +260,9 @@ class MOZ_RAII AutoProfilerTracing {
|
|||
mMarkerName(aMarkerName),
|
||||
mCategoryPair(aCategoryPair),
|
||||
mInnerWindowID(aInnerWindowID) {
|
||||
if (!profiler_thread_is_being_profiled_for_markers()) {
|
||||
return;
|
||||
}
|
||||
profiler_add_marker(
|
||||
mozilla::ProfilerString8View::WrapNullTerminatedString(mMarkerName),
|
||||
mCategoryPair,
|
||||
|
@ -279,6 +282,9 @@ class MOZ_RAII AutoProfilerTracing {
|
|||
mMarkerName(aMarkerName),
|
||||
mCategoryPair(aCategoryPair),
|
||||
mInnerWindowID(aInnerWindowID) {
|
||||
if (!profiler_thread_is_being_profiled_for_markers()) {
|
||||
return;
|
||||
}
|
||||
profiler_add_marker(
|
||||
mozilla::ProfilerString8View::WrapNullTerminatedString(mMarkerName),
|
||||
mCategoryPair,
|
||||
|
@ -291,6 +297,9 @@ class MOZ_RAII AutoProfilerTracing {
|
|||
}
|
||||
|
||||
~AutoProfilerTracing() {
|
||||
if (!profiler_thread_is_being_profiled_for_markers()) {
|
||||
return;
|
||||
}
|
||||
profiler_add_marker(
|
||||
mozilla::ProfilerString8View::WrapNullTerminatedString(mMarkerName),
|
||||
mCategoryPair,
|
||||
|
|
Загрузка…
Ссылка в новой задаче