Home

Awesome

GYMonitor

GYMonitor是用于监控iOS app性能状况的代码库,目前包括有FPS监控,发现FPS过低会自动产生堆栈,便于在开发过程中发现卡顿问题。

安装

使用CocoaPods

# Podfile
platform :ios, '7.0'
target 'YourTarget'
pod 'GYMonitor'

手工导入

使用

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // normal code...
    
    [self startMonitor];
    
    return YES;
}

- (void)startMonitor {
    [GYMonitor sharedInstance].monitorFPS = YES;
    [GYMonitor sharedInstance].showDebugView = YES;
    [[GYMonitor sharedInstance] startMonitor];
}

- (void)stopMonitor {
    [GYMonitor sharedInstance].monitorFPS = NO;
    [GYMonitor sharedInstance].showDebugView = NO;
    [[GYMonitor sharedInstance] startMonitor];
}

运行效果

<img src="https://raw.githubusercontent.com/featuretower/GYMonitor/master/GYMonitorExample/Screenshots/slow.png" width = "30%" height = "30%" alt="fps低" align=center /> <img src="https://github.com/featuretower/GYMonitor/blob/master/GYMonitorExample/Screenshots/stuck.png?raw=true" width = "30%" height = "30%" alt="fps卡顿" align=center /> <img src="https://github.com/featuretower/GYMonitor/blob/master/GYMonitorExample/Screenshots/stack_sim.png?raw=true" width = "30%" height = "30%" alt="模拟器上的堆栈" align=center />

(反解堆栈菜单) (mac上反解结果)

原理