├── .gitattributes ├── LICENSE ├── README.md ├── XXPerformanceMonitor.podspec └── XXPerformanceMonitor ├── Demo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift └── ViewController.swift ├── Source ├── XXChildThreadMonitor.swift ├── XXMainThreadMonitor.swift └── XXPerformanceMonitor.swift └── XXPerformanceMonitor.xcodeproj ├── project.pbxproj ├── project.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── huangjie13.xcuserdatad │ └── UserInterfaceState.xcuserstate └── xcuserdata └── huangjie13.xcuserdatad ├── xcdebugger └── Breakpoints_v2.xcbkptlist └── xcschemes └── xcschememanagement.plist /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 huangjie13 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## XXPerformanceMonitor 2 | ![pod](https://img.shields.io/badge/pod-v1.0.2-yellow) ![platforms](https://img.shields.io/badge/platforms-iOS-brightgreen) ![support](https://img.shields.io/badge/support-iOS%209%2B-informational) ![lisence](https://img.shields.io/badge/lisence-MIT-lightgrey) 3 | 4 | Swift版轻量卡顿监控工具,支持主线程和子线程,一句代码即可轻松集成。 5 | 6 | ## 上手指南 7 | 根据项目需要,在合适的地方启动,一般无特殊要求可以放在`AppDelegate`的`didFinishLaunching`中。 8 | 一句代码即可启动主线程监控: 9 | ``` 10 | XXPerformanceMonitor.sharedInstance.startMonitorMain() 11 | ``` 12 | 如果想要监听子线程队列,只需将其加入到监控器中: 13 | ``` 14 | let testQueue = OperationQueue() 15 | XXPerformanceMonitor.sharedInstance.addMonitorChild(testQueue) 16 | ``` 17 | 如果想停止监听,可以直接调用如下方法,关闭所有监控: 18 | ``` 19 | XXPerformanceMonitor.sharedInstance.clean() 20 | ``` 21 | 同时也提供了单独移除子线程监控的方法: 22 | ``` 23 | XXPerformanceMonitor.sharedInstance.removeMonitorChild(testQueue) 24 | ``` 25 | 并且提供了代理方法供外部获取卡顿信息: 26 | ``` 27 | public protocol XXPerformanceMonitorDelegate: class { 28 | func handleThread(reason: String, domain: XXPerformanceMonitorDomain) 29 | } 30 | ``` 31 | 更多详细请移步[《天罗地网? iOS卡顿监控实战》](https://juejin.im/post/5db65fe0e51d452a1e58f37c) 32 | 33 | ## 安装 34 | 1. Cocoapods 35 | 36 | ``` 37 | pod 'XXPerformanceMonitor' 38 | ``` 39 | 40 | 2. 下载源码,将Source文件夹添加到工程中。 41 | 42 | ## 其他 43 | 本库没有引入其他三方库,请放心使用。 44 | 45 | 有Bug或建议,欢迎issue。 46 | 47 | 如果使用还算顺畅,欢迎star :) -------------------------------------------------------------------------------- /XXPerformanceMonitor.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | 3 | spec.name = "XXPerformanceMonitor" 4 | spec.version = "1.1.1" 5 | spec.summary = "Swift版轻量卡顿监控工具,支持主线程和子线程,一句代码即可轻松集成" 6 | spec.homepage = "https://github.com/HJTXX/XXPerformanceMonitor" 7 | spec.license = "MIT" 8 | spec.author = { "HJTXX" => "517050790@qq.com" } 9 | 10 | spec.source = { :git => "https://github.com/HJTXX/XXPerformanceMonitor.git", :tag => spec.version } 11 | spec.source_files = "XXPerformanceMonitor/Source/*.swift" 12 | spec.platform = :ios, '9.0' 13 | spec.swift_version = '5.0' 14 | spec.requires_arc = true 15 | 16 | end 17 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // XXPerformanceMonitor 4 | // 5 | // Created by Huang,Jie on 2019/11/11. 6 | // Copyright © 2019 HJTXX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // XXPerformanceMonitor 4 | // 5 | // Created by Huang,Jie on 2019/11/11. 6 | // Copyright © 2019 HJTXX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | } 22 | 23 | func sceneDidDisconnect(_ scene: UIScene) { 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | func sceneDidBecomeActive(_ scene: UIScene) { 31 | // Called when the scene has moved from an inactive state to an active state. 32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 33 | } 34 | 35 | func sceneWillResignActive(_ scene: UIScene) { 36 | // Called when the scene will move from an active state to an inactive state. 37 | // This may occur due to temporary interruptions (ex. an incoming phone call). 38 | } 39 | 40 | func sceneWillEnterForeground(_ scene: UIScene) { 41 | // Called as the scene transitions from the background to the foreground. 42 | // Use this method to undo the changes made on entering the background. 43 | } 44 | 45 | func sceneDidEnterBackground(_ scene: UIScene) { 46 | // Called as the scene transitions from the foreground to the background. 47 | // Use this method to save data, release shared resources, and store enough scene-specific state information 48 | // to restore the scene back to its current state. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // XXPerformanceMonitor 4 | // 5 | // Created by Huang,Jie on 2019/11/11. 6 | // Copyright © 2019 HJTXX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | private let testQueue1 = OperationQueue() 14 | private let testQueue2 = OperationQueue() 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | let titles = ["启动线程监控", "阻塞主线程", "子线程1-添加", "子线程1-移除", "子线程2-添加", "子线程2-移除"] 20 | for i in 0.. Void) { 18 | pingThread = XXPingChildThread(t: threshold, handler: catchHandler) 19 | pingThread.start() 20 | } 21 | 22 | func addQueue(_ queue: OperationQueue) { 23 | pingThread.addQueue(queue) 24 | } 25 | 26 | func removeQueue(_ queue: OperationQueue) { 27 | pingThread.removeQueue(queue) 28 | } 29 | 30 | deinit { 31 | pingThread.cancel() 32 | } 33 | } 34 | 35 | private final class XXPingChildThread: Thread { 36 | private let threshold: CGFloat 37 | private let catchHandler: (OperationQueue) -> Void 38 | private(set) var queues: [OperationQueue] = [] // 需要监测的queue 39 | private(set) var executingOperations: [OperationQueue: Operation] = [:] // 各queue正在执行的operation 40 | 41 | init(t: CGFloat, handler: @escaping (OperationQueue) -> Void) { 42 | threshold = t 43 | catchHandler = handler 44 | super.init() 45 | } 46 | 47 | func addQueue(_ queue: OperationQueue) { 48 | if queues.contains(queue) { 49 | executingOperations.removeValue(forKey: queue) // 重复添加,重新开始 50 | } else { 51 | queues.append(queue) 52 | } 53 | } 54 | 55 | func removeQueue(_ queue: OperationQueue) { 56 | queues = queues.filter{ $0 != queue } 57 | } 58 | 59 | func clean() { 60 | queues.removeAll() 61 | executingOperations.removeAll() 62 | } 63 | 64 | override func main() { 65 | while !isCancelled { 66 | autoreleasepool { 67 | var isNewOperations: [OperationQueue: Bool] = [:] 68 | queues.forEach { (queue) in 69 | if executingOperations[queue] == nil && 70 | queue.operations.first?.isExecuting == true { 71 | executingOperations[queue] = queue.operations.first 72 | isNewOperations[queue] = true 73 | } 74 | } 75 | 76 | Thread.sleep(forTimeInterval: TimeInterval(threshold)) 77 | 78 | queues.forEach { (queue) in 79 | if executingOperations[queue]?.isExecuting == true { 80 | if isNewOperations[queue] == true { 81 | catchHandler(queue) 82 | } 83 | } else { 84 | executingOperations[queue] = nil 85 | } 86 | } 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Source/XXMainThreadMonitor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XXMainThreadMonitor.swift 3 | // XXPerformanceMonitor 4 | // 5 | // Created by Huang,Jie on 2019/11/11. 6 | // Copyright © 2019 HJTXX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class XXMainThreadMonitor { 12 | private let pingThread: XXPingMainThread 13 | 14 | public init(threshold: CGFloat, _ catchHandler: @escaping () -> Void) { 15 | pingThread = XXPingMainThread(threshold, catchHandler) 16 | pingThread.start() 17 | } 18 | 19 | deinit { 20 | pingThread.cancel() 21 | } 22 | } 23 | 24 | private final class XXPingMainThread: Thread { 25 | private let threshold: CGFloat 26 | private let catchHandler: () -> Void 27 | private let semaphore = DispatchSemaphore(value: 0) 28 | 29 | private let lockObj = NSObject() 30 | private var _isResponse = true 31 | private var isResponse: Bool { 32 | get { 33 | objc_sync_enter(lockObj) 34 | let result = _isResponse 35 | objc_sync_exit(lockObj) 36 | return result 37 | } 38 | 39 | set { 40 | objc_sync_enter(lockObj) 41 | _isResponse = newValue 42 | objc_sync_exit(lockObj) 43 | } 44 | } 45 | 46 | init(_ t: CGFloat, _ handler: @escaping () -> Void) { 47 | threshold = t 48 | catchHandler = handler 49 | super.init() 50 | } 51 | 52 | override func main() { 53 | while !isCancelled { 54 | autoreleasepool { 55 | isResponse = false 56 | DispatchQueue.main.async { 57 | self.isResponse = true 58 | self.semaphore.signal() 59 | } 60 | 61 | Thread.sleep(forTimeInterval: TimeInterval(threshold)) 62 | if !isResponse { 63 | catchHandler() 64 | } 65 | 66 | _ = semaphore.wait(timeout: DispatchTime.distantFuture) 67 | } 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/Source/XXPerformanceMonitor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XXPerformanceMonitor.swift 3 | // XXPerformanceMonitor 4 | // 5 | // Created by Huang,Jie on 2019/11/11. 6 | // Copyright © 2019 HJTXX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public enum XXPerformanceMonitorDomain: String { 12 | case mainThread = "HJTXX.MainThreadMonitoring" 13 | case childThread = "HJTXX.ChildThreadMonitoring" 14 | } 15 | 16 | public protocol XXPerformanceMonitorDelegate: class { 17 | func handleThread(reason: String, domain: XXPerformanceMonitorDomain) 18 | } 19 | 20 | public final class XXPerformanceMonitor: NSObject { 21 | public static let sharedInstance = XXPerformanceMonitor() 22 | public var mainThreadThreshold: CGFloat = 2 23 | public var childThreadThreshold: CGFloat = 2 24 | public weak var delegate: XXPerformanceMonitorDelegate? 25 | 26 | private var mainThreadMonitor: XXMainThreadMonitor? 27 | private var childThreadMonitor: XXChildThreadMonitor? 28 | 29 | public func startMonitorMain() { 30 | guard mainThreadMonitor == nil else { return } 31 | 32 | mainThreadMonitor = XXMainThreadMonitor(threshold: mainThreadThreshold) { [weak self] in 33 | guard let strongSelf = self else { return } 34 | strongSelf.delegate?.handleThread(reason: "👮‍♀️ MainThreadMonitor 👮‍♀️:主线程卡顿超过\(strongSelf.mainThreadThreshold)S", domain: .mainThread) 35 | } 36 | } 37 | 38 | public func addMonitorChild(_ queue: OperationQueue) { 39 | if childThreadMonitor == nil { 40 | childThreadMonitor = XXChildThreadMonitor(threshold: childThreadThreshold) { [weak self] (queue) in 41 | guard let strongSelf = self else { return } 42 | strongSelf.delegate?.handleThread(reason: "👮‍♀️ ChildThreadMonitor 👮‍♀️:子线程【\(queue.name ?? "")】卡顿超过\(strongSelf.childThreadThreshold)S", domain: .childThread) 43 | } 44 | } 45 | 46 | childThreadMonitor?.addQueue(queue) 47 | } 48 | 49 | public func removeMonitorChild(_ queue: OperationQueue) { 50 | childThreadMonitor?.removeQueue(queue) 51 | if let queuesCount = childThreadMonitor?.queues.count, queuesCount <= 0 { 52 | childThreadMonitor = nil 53 | } 54 | } 55 | 56 | public func clean() { 57 | mainThreadMonitor = nil 58 | childThreadMonitor = nil 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EBCC785E2378F69D00212AA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC785D2378F69D00212AA3 /* AppDelegate.swift */; }; 11 | EBCC78602378F69D00212AA3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC785F2378F69D00212AA3 /* SceneDelegate.swift */; }; 12 | EBCC78622378F69D00212AA3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC78612378F69D00212AA3 /* ViewController.swift */; }; 13 | EBCC78652378F69D00212AA3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EBCC78632378F69D00212AA3 /* Main.storyboard */; }; 14 | EBCC78672378F69F00212AA3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EBCC78662378F69F00212AA3 /* Assets.xcassets */; }; 15 | EBCC786A2378F6A000212AA3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EBCC78682378F6A000212AA3 /* LaunchScreen.storyboard */; }; 16 | EBCC7881237901DF00212AA3 /* XXPerformanceMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC7880237901DF00212AA3 /* XXPerformanceMonitor.swift */; }; 17 | EBCC78832379031600212AA3 /* XXMainThreadMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC78822379031600212AA3 /* XXMainThreadMonitor.swift */; }; 18 | EBCC78852379032C00212AA3 /* XXChildThreadMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBCC78842379032C00212AA3 /* XXChildThreadMonitor.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | EBCC785A2378F69D00212AA3 /* XXPerformanceMonitor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XXPerformanceMonitor.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | EBCC785D2378F69D00212AA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | EBCC785F2378F69D00212AA3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 25 | EBCC78612378F69D00212AA3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | EBCC78642378F69D00212AA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | EBCC78662378F69F00212AA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | EBCC78692378F6A000212AA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | EBCC786B2378F6A000212AA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | EBCC7880237901DF00212AA3 /* XXPerformanceMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XXPerformanceMonitor.swift; sourceTree = ""; }; 31 | EBCC78822379031600212AA3 /* XXMainThreadMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XXMainThreadMonitor.swift; sourceTree = ""; }; 32 | EBCC78842379032C00212AA3 /* XXChildThreadMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XXChildThreadMonitor.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | EBCC78572378F69D00212AA3 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | EBCC78512378F69D00212AA3 = { 47 | isa = PBXGroup; 48 | children = ( 49 | EBCC78732378F6F900212AA3 /* Source */, 50 | EBCC785C2378F69D00212AA3 /* Demo */, 51 | EBCC785B2378F69D00212AA3 /* Products */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | EBCC785B2378F69D00212AA3 /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | EBCC785A2378F69D00212AA3 /* XXPerformanceMonitor.app */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | EBCC785C2378F69D00212AA3 /* Demo */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | EBCC785D2378F69D00212AA3 /* AppDelegate.swift */, 67 | EBCC785F2378F69D00212AA3 /* SceneDelegate.swift */, 68 | EBCC78612378F69D00212AA3 /* ViewController.swift */, 69 | EBCC78632378F69D00212AA3 /* Main.storyboard */, 70 | EBCC78662378F69F00212AA3 /* Assets.xcassets */, 71 | EBCC78682378F6A000212AA3 /* LaunchScreen.storyboard */, 72 | EBCC786B2378F6A000212AA3 /* Info.plist */, 73 | ); 74 | path = Demo; 75 | sourceTree = ""; 76 | }; 77 | EBCC78732378F6F900212AA3 /* Source */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | EBCC7880237901DF00212AA3 /* XXPerformanceMonitor.swift */, 81 | EBCC78822379031600212AA3 /* XXMainThreadMonitor.swift */, 82 | EBCC78842379032C00212AA3 /* XXChildThreadMonitor.swift */, 83 | ); 84 | path = Source; 85 | sourceTree = ""; 86 | }; 87 | /* End PBXGroup section */ 88 | 89 | /* Begin PBXNativeTarget section */ 90 | EBCC78592378F69D00212AA3 /* XXPerformanceMonitor */ = { 91 | isa = PBXNativeTarget; 92 | buildConfigurationList = EBCC786E2378F6A000212AA3 /* Build configuration list for PBXNativeTarget "XXPerformanceMonitor" */; 93 | buildPhases = ( 94 | EBCC78562378F69D00212AA3 /* Sources */, 95 | EBCC78572378F69D00212AA3 /* Frameworks */, 96 | EBCC78582378F69D00212AA3 /* Resources */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = XXPerformanceMonitor; 103 | productName = XXPerformanceMonitor; 104 | productReference = EBCC785A2378F69D00212AA3 /* XXPerformanceMonitor.app */; 105 | productType = "com.apple.product-type.application"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | EBCC78522378F69D00212AA3 /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | LastSwiftUpdateCheck = 1120; 114 | LastUpgradeCheck = 1120; 115 | ORGANIZATIONNAME = HJTXX; 116 | TargetAttributes = { 117 | EBCC78592378F69D00212AA3 = { 118 | CreatedOnToolsVersion = 11.2; 119 | LastSwiftMigration = 1120; 120 | }; 121 | }; 122 | }; 123 | buildConfigurationList = EBCC78552378F69D00212AA3 /* Build configuration list for PBXProject "XXPerformanceMonitor" */; 124 | compatibilityVersion = "Xcode 9.3"; 125 | developmentRegion = en; 126 | hasScannedForEncodings = 0; 127 | knownRegions = ( 128 | en, 129 | Base, 130 | ); 131 | mainGroup = EBCC78512378F69D00212AA3; 132 | productRefGroup = EBCC785B2378F69D00212AA3 /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | EBCC78592378F69D00212AA3 /* XXPerformanceMonitor */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXResourcesBuildPhase section */ 142 | EBCC78582378F69D00212AA3 /* Resources */ = { 143 | isa = PBXResourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | EBCC786A2378F6A000212AA3 /* LaunchScreen.storyboard in Resources */, 147 | EBCC78672378F69F00212AA3 /* Assets.xcassets in Resources */, 148 | EBCC78652378F69D00212AA3 /* Main.storyboard in Resources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXResourcesBuildPhase section */ 153 | 154 | /* Begin PBXSourcesBuildPhase section */ 155 | EBCC78562378F69D00212AA3 /* Sources */ = { 156 | isa = PBXSourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | EBCC78832379031600212AA3 /* XXMainThreadMonitor.swift in Sources */, 160 | EBCC78622378F69D00212AA3 /* ViewController.swift in Sources */, 161 | EBCC785E2378F69D00212AA3 /* AppDelegate.swift in Sources */, 162 | EBCC78602378F69D00212AA3 /* SceneDelegate.swift in Sources */, 163 | EBCC7881237901DF00212AA3 /* XXPerformanceMonitor.swift in Sources */, 164 | EBCC78852379032C00212AA3 /* XXChildThreadMonitor.swift in Sources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXSourcesBuildPhase section */ 169 | 170 | /* Begin PBXVariantGroup section */ 171 | EBCC78632378F69D00212AA3 /* Main.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | EBCC78642378F69D00212AA3 /* Base */, 175 | ); 176 | name = Main.storyboard; 177 | sourceTree = ""; 178 | }; 179 | EBCC78682378F6A000212AA3 /* LaunchScreen.storyboard */ = { 180 | isa = PBXVariantGroup; 181 | children = ( 182 | EBCC78692378F6A000212AA3 /* Base */, 183 | ); 184 | name = LaunchScreen.storyboard; 185 | sourceTree = ""; 186 | }; 187 | /* End PBXVariantGroup section */ 188 | 189 | /* Begin XCBuildConfiguration section */ 190 | EBCC786C2378F6A000212AA3 /* Debug */ = { 191 | isa = XCBuildConfiguration; 192 | buildSettings = { 193 | ALWAYS_SEARCH_USER_PATHS = NO; 194 | CLANG_ANALYZER_NONNULL = YES; 195 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_ENABLE_OBJC_WEAK = YES; 201 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_COMMA = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 207 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 208 | CLANG_WARN_EMPTY_BODY = YES; 209 | CLANG_WARN_ENUM_CONVERSION = YES; 210 | CLANG_WARN_INFINITE_RECURSION = YES; 211 | CLANG_WARN_INT_CONVERSION = YES; 212 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 214 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 215 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 216 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 217 | CLANG_WARN_STRICT_PROTOTYPES = YES; 218 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 219 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | COPY_PHASE_STRIP = NO; 223 | DEBUG_INFORMATION_FORMAT = dwarf; 224 | ENABLE_STRICT_OBJC_MSGSEND = YES; 225 | ENABLE_TESTABILITY = YES; 226 | GCC_C_LANGUAGE_STANDARD = gnu11; 227 | GCC_DYNAMIC_NO_PIC = NO; 228 | GCC_NO_COMMON_BLOCKS = YES; 229 | GCC_OPTIMIZATION_LEVEL = 0; 230 | GCC_PREPROCESSOR_DEFINITIONS = ( 231 | "DEBUG=1", 232 | "$(inherited)", 233 | ); 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 241 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 242 | MTL_FAST_MATH = YES; 243 | ONLY_ACTIVE_ARCH = YES; 244 | SDKROOT = iphoneos; 245 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 246 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 247 | }; 248 | name = Debug; 249 | }; 250 | EBCC786D2378F6A000212AA3 /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_ENABLE_OBJC_WEAK = YES; 261 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_COMMA = YES; 264 | CLANG_WARN_CONSTANT_CONVERSION = YES; 265 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 268 | CLANG_WARN_EMPTY_BODY = YES; 269 | CLANG_WARN_ENUM_CONVERSION = YES; 270 | CLANG_WARN_INFINITE_RECURSION = YES; 271 | CLANG_WARN_INT_CONVERSION = YES; 272 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 273 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 274 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 277 | CLANG_WARN_STRICT_PROTOTYPES = YES; 278 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 279 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | COPY_PHASE_STRIP = NO; 283 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 284 | ENABLE_NS_ASSERTIONS = NO; 285 | ENABLE_STRICT_OBJC_MSGSEND = YES; 286 | GCC_C_LANGUAGE_STANDARD = gnu11; 287 | GCC_NO_COMMON_BLOCKS = YES; 288 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 289 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 290 | GCC_WARN_UNDECLARED_SELECTOR = YES; 291 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 292 | GCC_WARN_UNUSED_FUNCTION = YES; 293 | GCC_WARN_UNUSED_VARIABLE = YES; 294 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 295 | MTL_ENABLE_DEBUG_INFO = NO; 296 | MTL_FAST_MATH = YES; 297 | SDKROOT = iphoneos; 298 | SWIFT_COMPILATION_MODE = wholemodule; 299 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 300 | VALIDATE_PRODUCT = YES; 301 | }; 302 | name = Release; 303 | }; 304 | EBCC786F2378F6A000212AA3 /* Debug */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 308 | CLANG_ENABLE_MODULES = YES; 309 | CODE_SIGN_STYLE = Automatic; 310 | DEVELOPMENT_TEAM = 8F92H223RC; 311 | INFOPLIST_FILE = "$(SRCROOT)/Demo/Info.plist"; 312 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 313 | LD_RUNPATH_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "@executable_path/Frameworks", 316 | ); 317 | PRODUCT_BUNDLE_IDENTIFIER = HJTXX.XXPerformanceMonitor; 318 | PRODUCT_NAME = "$(TARGET_NAME)"; 319 | SWIFT_OBJC_BRIDGING_HEADER = ""; 320 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 321 | SWIFT_VERSION = 5.0; 322 | TARGETED_DEVICE_FAMILY = "1,2"; 323 | }; 324 | name = Debug; 325 | }; 326 | EBCC78702378F6A000212AA3 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 330 | CLANG_ENABLE_MODULES = YES; 331 | CODE_SIGN_STYLE = Automatic; 332 | DEVELOPMENT_TEAM = 8F92H223RC; 333 | INFOPLIST_FILE = "$(SRCROOT)/Demo/Info.plist"; 334 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 335 | LD_RUNPATH_SEARCH_PATHS = ( 336 | "$(inherited)", 337 | "@executable_path/Frameworks", 338 | ); 339 | PRODUCT_BUNDLE_IDENTIFIER = HJTXX.XXPerformanceMonitor; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | SWIFT_OBJC_BRIDGING_HEADER = ""; 342 | SWIFT_VERSION = 5.0; 343 | TARGETED_DEVICE_FAMILY = "1,2"; 344 | }; 345 | name = Release; 346 | }; 347 | /* End XCBuildConfiguration section */ 348 | 349 | /* Begin XCConfigurationList section */ 350 | EBCC78552378F69D00212AA3 /* Build configuration list for PBXProject "XXPerformanceMonitor" */ = { 351 | isa = XCConfigurationList; 352 | buildConfigurations = ( 353 | EBCC786C2378F6A000212AA3 /* Debug */, 354 | EBCC786D2378F6A000212AA3 /* Release */, 355 | ); 356 | defaultConfigurationIsVisible = 0; 357 | defaultConfigurationName = Release; 358 | }; 359 | EBCC786E2378F6A000212AA3 /* Build configuration list for PBXNativeTarget "XXPerformanceMonitor" */ = { 360 | isa = XCConfigurationList; 361 | buildConfigurations = ( 362 | EBCC786F2378F6A000212AA3 /* Debug */, 363 | EBCC78702378F6A000212AA3 /* Release */, 364 | ); 365 | defaultConfigurationIsVisible = 0; 366 | defaultConfigurationName = Release; 367 | }; 368 | /* End XCConfigurationList section */ 369 | }; 370 | rootObject = EBCC78522378F69D00212AA3 /* Project object */; 371 | } 372 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/project.xcworkspace/xcuserdata/huangjie13.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJTXX/XXPerformanceMonitor/277cd3ddc5a8bb0392db1f2a30db543199289b51/XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/project.xcworkspace/xcuserdata/huangjie13.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/xcuserdata/huangjie13.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /XXPerformanceMonitor/XXPerformanceMonitor.xcodeproj/xcuserdata/huangjie13.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XXPerformanceMonitor.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | --------------------------------------------------------------------------------