diff --git a/shared/ios/Keybase.xcodeproj/project.pbxproj b/shared/ios/Keybase.xcodeproj/project.pbxproj index f36a7d56797f..ee9d8d2255fb 100644 --- a/shared/ios/Keybase.xcodeproj/project.pbxproj +++ b/shared/ios/Keybase.xcodeproj/project.pbxproj @@ -36,12 +36,12 @@ DB33CB6B2DFB02E9000472AA /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB33CB6A2DFB02E9000472AA /* ShareViewController.swift */; }; DB59F9B72238A27E00E271C1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB59F97B2238A27E00E271C1 /* JavaScriptCore.framework */; }; DBB8CC212DF336C200D43215 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBB8CC202DF336C200D43215 /* AppDelegate.swift */; }; - DBMT00012DF336C200D43215 /* MainThreadWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBMT00002DF336C200D43215 /* MainThreadWatchdog.swift */; }; DBBE59452DF394F700A74A2D /* keybasego.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBBE59442DF394F700A74A2D /* keybasego.xcframework */; }; DBD252982DF32D5C008A43FF /* Fs.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBD252972DF32D5C008A43FF /* Fs.swift */; }; DBDCF30E1B8D03DD00BA95D8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DBDCF3081B8D03DD00BA95D8 /* Images.xcassets */; }; DBDF89F62DF7779900EA18C2 /* Pusher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBDF89F52DF7779900EA18C2 /* Pusher.swift */; }; DBF123462DF1234500A12345 /* ShareIntentDonatorImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBF123452DF1234500A12345 /* ShareIntentDonatorImpl.swift */; }; + DBMT00012DF336C200D43215 /* MainThreadWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBMT00002DF336C200D43215 /* MainThreadWatchdog.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -112,7 +112,6 @@ DB33CB6A2DFB02E9000472AA /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; DB59F97B2238A27E00E271C1 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; DBB8CC202DF336C200D43215 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - DBMT00002DF336C200D43215 /* MainThreadWatchdog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainThreadWatchdog.swift; sourceTree = ""; }; DBBE59442DF394F700A74A2D /* keybasego.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = keybasego.xcframework; sourceTree = ""; }; DBD252972DF32D5C008A43FF /* Fs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fs.swift; sourceTree = ""; }; DBDCF3081B8D03DD00BA95D8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; @@ -120,6 +119,7 @@ DBDCF3441B8D04FC00BA95D8 /* Keybase-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Keybase-Bridging-Header.h"; sourceTree = ""; }; DBDF89F52DF7779900EA18C2 /* Pusher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pusher.swift; sourceTree = ""; }; DBF123452DF1234500A12345 /* ShareIntentDonatorImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareIntentDonatorImpl.swift; sourceTree = ""; }; + DBMT00002DF336C200D43215 /* MainThreadWatchdog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainThreadWatchdog.swift; sourceTree = ""; }; F68DC40B579A1F9AC0F34950 /* Pods_KeybaseShare.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KeybaseShare.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ diff --git a/shared/ios/Keybase/MainThreadWatchdog.swift b/shared/ios/Keybase/MainThreadWatchdog.swift index 23cc9072f8ec..d88a1f1c09c2 100644 --- a/shared/ios/Keybase/MainThreadWatchdog.swift +++ b/shared/ios/Keybase/MainThreadWatchdog.swift @@ -77,7 +77,7 @@ class MainThreadWatchdog { var lastLogTime: CFAbsoluteTime = 0 while true { - Thread.sleep(forTimeInterval: 1.0) + Thread.sleep(forTimeInterval: 0.5) lock.lock() let isActive = active @@ -115,12 +115,12 @@ class MainThreadWatchdog { let totalElapsedMs = (now - appStartTime) * 1000 - if blockDuration >= 3.0 { - // Sample every 2s for the duration of the hang so we capture how the main thread + if blockDuration >= 1.0 { + // Sample every 1s for the duration of the hang so we capture how the main thread // evolves (e.g. keychain IPC → rendering → idle) rather than a single snapshot. - if lastLogTime == 0 || (now - lastLogTime) >= 2.0 { + if lastLogTime == 0 || (now - lastLogTime) >= 1.0 { let bgElapsedSec = now - bgEnterTime - let msg = String(format: "Watchdog: main thread blocked %.0fs after foreground resume (%.0fs since background, %.0fms since launch)", blockDuration, bgElapsedSec, totalElapsedMs) + let msg = String(format: "Watchdog: main thread blocked %.1fs after foreground resume (%.0fs since background, %.0fms since launch)", blockDuration, bgElapsedSec, totalElapsedMs) NSLog("[Startup] %@", msg) // Enqueue a write for when the main thread recovers DispatchQueue.main.async { [weak self] in