Skip to content

Commit 6144583

Browse files
authored
Merge pull request #721 from Tencent/feature/ios
Matrix iOS Feb 2022 Update
2 parents c7c07b1 + 5608a20 commit 6144583

File tree

125 files changed

+6210
-1908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+6210
-1908
lines changed

README.md

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99
[Matrix for iOS/macOS 中文版](#matrix_ios_cn)
1010
[Matrix for android 中文版](#matrix_android_cn)
1111
[Matrix for iOS/macOS](#matrix_ios_en)
12-
[Matrix for android ](#matrix_android_en)
12+
[Matrix for android](#matrix_android_en)
1313

1414
**Matrix** is an APM (Application Performance Manage) used in Wechat to monitor, locate and analyse performance problems. It is a **plugin style**, **non-invasive** solution and is currently available on iOS, macOS and Android.
1515

1616
# <a name='matrix_ios_en'> Matrix for iOS/macOS </a>
1717

18-
The monitoring scope of the current tool includes: crash, lag, and out-of-memory, which includes the following two plugins:
18+
The monitoring scope of the current tool includes: crash, lag, and memory, which includes the following three plugins:
1919

2020
* **WCCrashBlockMonitorPlugin:** Based on [KSCrash](https://github.com/kstenerud/KSCrash) framework, it features cutting-edge lag stack capture capabilities with crash capture.
2121

22-
* **WCMemoryStatPlugin:** A performance-optimized out-of-memory monitoring tool that captures memory allocation and the callstack of an application's out-of-memory event.
22+
* **WCMemoryStatPlugin:** A memory monitoring tool that captures memory allocation and the callstack of an application's memory event.
23+
24+
* **WCFPSMonitorPlugin:** A fps monitoring tool that captures main thread's callstack while user scrolling.
2325

2426
## Features
2527

@@ -32,18 +34,10 @@ The monitoring scope of the current tool includes: crash, lag, and out-of-memory
3234
#### WCMemoryStatPlugin
3335

3436
* Live recording every object's creating and the corresponding callstack of its creation, and report it when the application out-of-memory is detected.
35-
* Use a balanced binary tree to store living objects and a hash table to store the callstack to optimize performance to the extreme
3637

3738
## Getting Started
3839
#### Install
3940

40-
* **Install via Cocoapods**
41-
1. Install [CocoaPods](https://guides.cocoapods.org/using/getting-started.html);
42-
2. Run `pod repo update` to make CocoaPods aware of the latest available `matrix` versions;
43-
3. In your Podfile, add `pod 'matrix-wechat'` to your app target, from the command line, run `pod install`;
44-
4. Use the .xcworkspace file generated by CocoaPods to work on your project;
45-
5. Add `#import <Matrix/Matrix.h>` , then you can use the performance probe tool of WeChat.
46-
4741
* **Install with static framework**
4842
1. Get source code of Matrix;
4943
2. Open terminal, execute `make` in the `matrix/matrix-iOS` directory to compile and generate static library. After compiling, the iOS platform library is in the `matrix/matrix-iOS/build_ios` directory, and the macOS platform library is in the `matrix/matrix-iOS/build_macos` directory.
@@ -73,15 +67,16 @@ WCCrashBlockMonitorPlugin *crashBlockPlugin = [[WCCrashBlockMonitorPlugin alloc]
7367
[curBuilder addPlugin:crashBlockPlugin]; // add lag and crash monitor.
7468

7569
WCMemoryStatPlugin *memoryStatPlugin = [[WCMemoryStatPlugin alloc] init];
76-
[curBuilder addPlugin:memoryStatPlugin]; // add out-of-memory monitor.
70+
[curBuilder addPlugin:memoryStatPlugin]; // add memory monitor.
71+
72+
WCFPSMonitorPlugin *fpsMonitorPlugin = [[WCFPSMonitorPlugin alloc] init];
73+
[curBuilder addPlugin:fpsMonitorPlugin]; // add fps monitor.
7774

7875
[matrix addMatrixBuilder:curBuilder];
7976

8077
[crashBlockPlugin start]; // start the lag and crash monitor.
81-
// [memoryStatPlugin start];
82-
// start out-of-memory monitor
83-
// Be careful, WCMemoryStatPlugin has a large performance loss after it is turned on. It is recommended to turn it on as needed.
84-
78+
[memoryStatPlugin start]; // start memory monitor
79+
[fpsMonitorPlugin start]; // start fps monitor
8580
```
8681
8782
#### Receive callbacks to obtain monitoring data
@@ -109,7 +104,7 @@ Each plugin added to `MatrixBuilder` will call back the corresponding event via
109104

110105
## Tutorials
111106

112-
At this point, Matrix has been integrated into the app and is beginning to collect crash, lag, and out-of-memory data. If you still have questions, check out the example: `samples/sample-apple/MatrixDemo`.
107+
At this point, Matrix has been integrated into the app and is beginning to collect crash, lag, and memory data. If you still have questions, check out the example: `samples/sample-iOS/MatrixDemo`.
113108

114109

115110

@@ -439,11 +434,13 @@ Matrix 通过接入各种性能监控方案,对性能监控项的异常数据
439434
440435
# <a name='matrix_ios_cn'>Matrix for iOS/macOS </a>
441436
442-
当前工具监控范围包括:崩溃、卡顿和爆内存,包含以下两款插件
437+
Matrix-iOS 当前工具监控范围包括:崩溃、卡顿和内存,包含以下三款插件
443438
444-
* **WCCrashBlockMonitorPlugin:** 基于 [KSCrash](https://github.com/kstenerud/KSCrash) 框架开发,具有业界领先的卡顿堆栈捕获能力,同时兼备崩溃捕获能力
439+
* **WCCrashBlockMonitorPlugin:** 基于 [KSCrash](https://github.com/kstenerud/KSCrash) 框架开发,具有业界领先的卡顿堆栈捕获能力,同时兼备崩溃捕获能力
445440
446-
* **WCMemoryStatPlugin:** 一款性能优化到极致的爆内存监控工具,能够全面捕获应用爆内存时的内存分配以及调用堆栈情况。
441+
* **WCMemoryStatPlugin:** 一款性能极致的内存监控工具,能够全面捕获应用 OOM 时的内存分配以及调用堆栈情况
442+
443+
* **WCFPSMonitorPlugin:** 一款 FPS 监控工具,当用户滑动界面时,记录主线程调用栈
447444
448445
## 特性
449446
@@ -455,18 +452,11 @@ Matrix 通过接入各种性能监控方案,对性能监控项的异常数据
455452
456453
#### WCMemoryStatPlugin
457454
458-
* 在应用运行期间获取对象存活以及相应的堆栈信息,在检测到应用爆内存时进行上报
459-
* 使用平衡二叉树存储存活对象,使用 Hash Table 存储堆栈,将性能优化到极致
455+
* 在应用运行期间获取对象存活以及相应的堆栈信息,在检测到应用 OOM 时进行上报
460456
461457
## 使用方法
462458
463459
#### 安装
464-
* **通过 Cocoapods 安装**
465-
1. 先安装 [CocoaPods](https://guides.cocoapods.org/using/getting-started.html);
466-
2. 通过 pod repo update 更新 matrix 的 Cocoapods 版本;
467-
3. 在 Podfile 对应的 target 中,添加 pod 'matrix-wechat',并执行 pod install;
468-
4. 在项目中使用 Cocoapods 生成的 .xcworkspace运行工程;
469-
5. 在你的代码文件头引入头文件 #import <Matrix/Matrix.h>,就可以接入微信的性能探针工具了!
470460
471461
* **通过静态库安装**
472462
1. 获取 Matrix 源码;
@@ -499,13 +489,15 @@ WCCrashBlockMonitorPlugin *crashBlockPlugin = [[WCCrashBlockMonitorPlugin alloc]
499489
500490
WCMemoryStatPlugin *memoryStatPlugin = [[WCMemoryStatPlugin alloc] init];
501491
[curBuilder addPlugin:memoryStatPlugin]; // 添加内存监控功能
492+
493+
WCFPSMonitorPlugin *fpsMonitorPlugin = [[WCFPSMonitorPlugin alloc] init];
494+
[curBuilder addPlugin:fpsMonitorPlugin]; // 添加 fps 监控功能
502495
503496
[matrix addMatrixBuilder:curBuilder];
504497
505498
[crashBlockPlugin start]; // 开启卡顿和崩溃监控
506-
// [memoryStatPlugin start];
507-
// 开启内存监控,注意 memoryStatPlugin 开启之后对性能损耗较大,建议按需开启
508-
499+
[memoryStatPlugin start]; // 开启内存监控
500+
[fpsMonitorPlugin start]; // 开启 fps 监控
509501
```
510502

511503
#### 接收回调获得监控数据
@@ -533,7 +525,7 @@ curBuilder.pluginListener = <一个遵循 MatrixPluginListenerDelegate 的对象
533525

534526
## Demo
535527

536-
至此,Matrix 已经集成到应用中并且开始收集崩溃、ANR、卡顿和爆内存数据,如仍有疑问,请查看示例:`samples/sample-apple/MatrixDemo`
528+
至此,Matrix 已经集成到应用中并且开始收集崩溃、卡顿和爆内存数据,如仍有疑问,请查看示例:`samples/sample-iOS/MatrixDemo`
537529

538530

539531
# <a name='matrix_android_cn'>Matrix for Android </a>

0 commit comments

Comments
 (0)