To run the example project, clone the repo, and run pod install
from the Example directory first.
typedef NS_OPTIONS(NSUInteger, AppMonitorOptions) {
AppMonitorCPUUsage = 1 << 0,
AppMonitorMainRunLoopStuck = 1 << 1,
};
@interface AppMonitor : NSObject
+ (instancetype)sharedInstance;
- (void)startMointor:(AppMonitorOptions)options;
- (void)stopMointor:(AppMonitorOptions)options;
@end
@interface AppMonitor (FuncTime)
- (void)start;
- (void)startWithMaxDepth:(int)depth;
- (void)startWithMinTimeCost:(double)ms;
- (void)startWithMaxDepth:(int)depth minTimeCost:(double)ms;
- (void)saveToDB;
- (void)stop;
- (void)clearMemory;
@end
// 本类只负责本地记录,上传需求比较灵活,此处不再封装
@interface AppMonitor (Record)
- (void)recordStackInfo:(AMStackModel *)model;
- (void)clearStackInfo;
- (void)recordFuncInfo:(AMFuncCostModel *)model;
- (void)clearFuncInfo;
@end
- 程序有消耗性能的地方 thread get state。这个也会被监控检查出,所以可以过滤掉这样的堆栈信息
AppMonitor is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ISAppMonitor'
-> ISAppMonitor (0.1.9)
集成有关App的性能监控功能
pod 'ISAppMonitor', '~> 0.1.9'
- Homepage: https://github.com/iBlackStone/AppMonitor
- Source: https://github.com/iBlackStone/AppMonitor.git
- Versions: 0.1.9 [Master repo]
- Subspecs:
- ISAppMonitor/Core (0.1.9)
- ISAppMonitor/Database (0.1.9)
- ISAppMonitor/Model (0.1.9)
- ISAppMonitor/Utils (0.1.9)
(END)
参考大牛代码,感谢他们无私的分享
- 戴铭 - iOS开发高手课
AppMonitor is available under the MIT license. See the LICENSE file for more info.