MonitorCpuUsage 0.1.1

MonitorCpuUsage 0.1.1

维护者:HeXiulian.



  • HeXiuLian

MonitorCpuUsage

CI Status Version License Platform

示例

要运行示例项目,首先克隆仓库,然后在示例目录中运行 pod install

要求

效果图

安装

MonitorCpuUsage 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中。

pod 'MonitorCpuUsage'

使用方法

#import <MonitorCpuUsage/XLMonitorHandle.h>
#import <MonitorCpuUsage/XLBrokenLineViewController.h>

开始监控:

[[XLMonitorHandle shareInstance] setCpuUsageMax:35];
[[XLMonitorHandle shareInstance] startMonitorFpsAndCpuUsage];

显示折线图:

XLBrokenLineViewController *eblVC = [[XLBrokenLineViewController alloc] init];
[self.navigationController pushViewController:eblVC animated:YES];

XLMonitorHandle 常用 API

///存储监测的数据
@property (nonatomic, strong) NSMutableArray  *arrMonitorData;

+ (instancetype)shareInstance;

/**
 开始监测
 */
- (void)startMonitorFpsAndCpuUsage;

/**
 停止监测
 */
- (void)stopMonitor;

/**
 是否打印 cpuUsage和fps的值
 @param logStatus 默认NO
 */
- (void)setLogStatus:(BOOL)logStatus;

/**
 清除已经收集的数据
 */
- (void)clearMonitorData;

/**
 设置超过最大cpu使用率的值

 @param UsageMax 最大使用率 默认 90
 */
- (void)setCpuUsageMax:(CGFloat)UsageMax;

@end

注意:如果曲线图的左右滚动失效,请修改库 PYZoomEchartsView 类的源码如下:


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
#if TARGET_OS_IPHONE
//注释如下代码
//        UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchHandle:)];
//        [self addGestureRecognizer:pinchGesture];
//
//        UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panHandle:)];
//        [self addGestureRecognizer:panGesture];
#elif TARGET_OS_MAC
#endif
    }
    return self;
}

作者

[email protected][email protected]

许可协议

MonitorCpuUsage 在MIT许可协议下可用。请参阅LICENSE文件获取更多信息。