From a16a5d97d45be98cadf0728bae9a78d6d87ff379 Mon Sep 17 00:00:00 2001
From: Alexander Alekseev <alemate@chromium.org>
Date: Wed, 9 Aug 2023 17:44:56 +0000
Subject: [PATCH] Add ChromeOS trace events in
 /chromeos/ash/components/sync_wifi

Investigating ChromeOS login performance revealed that many potentially slow UI
thread tasks are not instrumented. This Cl adds some events around slow tasks
that we saw in our tests.

Bug: b:293198304

CC=achuith@chromium.org

This CL was uploaded by git cl split.

R=jonmann@chromium.org

Change-Id: Ib657d282fe6fff342c268a51584b9057a3926593
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4765816
Auto-Submit: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Jon Mann <jonmann@chromium.org>
Commit-Queue: Jon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1181577}
---
 chromeos/ash/components/sync_wifi/wifi_configuration_bridge.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/chromeos/ash/components/sync_wifi/wifi_configuration_bridge.cc b/chromeos/ash/components/sync_wifi/wifi_configuration_bridge.cc
index 41baa627989a7..a4eec194f5ab2 100644
--- a/chromeos/ash/components/sync_wifi/wifi_configuration_bridge.cc
+++ b/chromeos/ash/components/sync_wifi/wifi_configuration_bridge.cc
@@ -15,6 +15,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/time/clock.h"
 #include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
 #include "base/values.h"
 #include "chromeos/ash/components/network/network_configuration_handler.h"
 #include "chromeos/ash/components/network/network_event_log.h"
@@ -392,6 +393,7 @@ void WifiConfigurationBridge::OnFixAutoconnectComplete() {
 void WifiConfigurationBridge::OnReadAllMetadata(
     const absl::optional<syncer::ModelError>& error,
     std::unique_ptr<syncer::MetadataBatch> metadata_batch) {
+  TRACE_EVENT0("ui", "WifiConfigurationBridge::OnReadAllMetadata");
   if (error) {
     change_processor()->ReportError(*error);
     return;