Skip to content

Commit

Permalink
Bug 1798388 - add profiler markers for common accessibility functions…
Browse files Browse the repository at this point in the history
…. r=eeejay

Here is a sample profile with the new markers: https://share.firefox.dev/3DMY1cs

Differential Revision: https://phabricator.services.mozilla.com/D160847
  • Loading branch information
mcomella committed Nov 2, 2022
1 parent 10a0137 commit d5ba547
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion accessible/base/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/PresShell.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ProfilerMarkers.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/Telemetry.h"

Expand Down Expand Up @@ -611,7 +611,10 @@ void NotificationController::ProcessMutationEvents() {
// NotificationCollector: private

void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
AUTO_PROFILER_MARKER_TEXT("NotificationController::WillRefresh", A11Y, {},
""_ns);
Telemetry::AutoTimer<Telemetry::A11Y_TREE_UPDATE_TIMING_MS> timer;
// DO NOT ADD CODE ABOVE THIS BLOCK: THIS CODE IS MEASURING TIMINGS.

AUTO_PROFILER_LABEL("NotificationController::WillRefresh", A11Y);

Expand Down
4 changes: 4 additions & 0 deletions accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
#include "mozilla/dom/HTMLTableElement.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ProfilerMarkers.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/SVGGeometryFrame.h"
Expand Down Expand Up @@ -1218,6 +1219,9 @@ mozilla::Monitor& nsAccessibilityService::GetAndroidMonitor() {
// nsAccessibilityService private

bool nsAccessibilityService::Init() {
AUTO_PROFILER_MARKER_TEXT("nsAccessibilityService::Init", A11Y, {}, ""_ns);
// DO NOT ADD CODE ABOVE HERE: THIS CODE IS MEASURING TIMINGS.

// Initialize accessible document manager.
if (!DocManager::Init()) return false;

Expand Down
4 changes: 4 additions & 0 deletions accessible/generic/DocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "DocAccessibleChild.h"
#include "EventTree.h"
#include "HTMLImageMapAccessible.h"
#include "mozilla/ProfilerMarkers.h"
#include "nsAccCache.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
Expand Down Expand Up @@ -1579,6 +1580,9 @@ void DocAccessible::NotifyOfLoading(bool aIsReloading) {
}

void DocAccessible::DoInitialUpdate() {
AUTO_PROFILER_MARKER_TEXT("DocAccessible::DoInitialUpdate", A11Y, {}, ""_ns);
// DO NOT ADD CODE ABOVE THIS BLOCK: THIS CODE IS MEASURING TIMINGS.

if (nsCoreUtils::IsTopLevelContentDocInProcess(mDocumentNode)) {
mDocFlags |= eTopLevelContentDocInProcess;
if (IPCAccessibilityActive()) {
Expand Down
12 changes: 12 additions & 0 deletions accessible/generic/LocalAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,18 @@ void LocalAccessible::SendCache(uint64_t aCacheDomain,
nsTArray<CacheData> data;
data.AppendElement(CacheData(ID(), fields));
ipcDoc->SendCache(aUpdateType, data, true);

if (profiler_thread_is_being_profiled_for_markers()) {
nsAutoCString updateTypeStr;
if (aUpdateType == CacheUpdateType::Initial) {
updateTypeStr = "Initial";
} else if (aUpdateType == CacheUpdateType::Update) {
updateTypeStr = "Update";
} else {
updateTypeStr = "Other";
}
PROFILER_MARKER_TEXT("LocalAccessible::SendCache", A11Y, {}, updateTypeStr);
}
}

already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
Expand Down

0 comments on commit d5ba547

Please sign in to comment.