featuretower / GYMonitor

A collection of code for profiling iOS app, such as monitoring FPS.
MIT License
329 stars 72 forks source link

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];
}

运行效果

fps低 fps卡顿 模拟器上的堆栈

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

原理