Tencent /matrix
Matrix is a plugin style, non-invasive APM system developed by WeChat.
★ 12,071⑂ 1,924
12,071
stars
+-2+-2+14
1,924
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions
README
!Matrix-icon
(中文版本请参看这里)
Matrix for iOS/macOS 中文版
Matrix for android 中文版
Matrix for iOS/macOS
Matrix for android
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.
Matrix for iOS/macOS
The monitoring scope of the current tool includes: crash, lag, and memory, which includes the following three plugins:
WCCrashBlockMonitorPlugin: Based on KSCrash framework, it features cutting-edge lag stack capture capabilities with crash capture.
WCMemoryStatPlugin: A memory monitoring tool that captures memory allocation and the callstack of an application's memory event.
WCFPSMonitorPlugin: A fps monitoring tool that captures main thread's callstack while user scrolling.
Features
WCCrashBlockMonitorPlugin
Easy integration, no code intrusion.
Determine whether the app is stuck by checking the running status of the Runloop, and support both the iOS and macOS platform.
Add time-consuming stack fetching, attaching the most time-consuming main thread stack to the thread snapshot log.
WCMemoryStatPlugin
Live recording every object's creating and the corresponding callstack of its creation, and report it when the application out-of-memory is detected.
Getting Started
Install
Install with static framework
1. Get source code of Matrix;
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.
3. Link with static framework in the project:
iOS : Use Matrix.framework under the matrix/matrix-iOS/build_ios path, link Matrix.framework to the project as a static library;
macOS : Use Matrix.framework under the matrix/matrix-iOS/build_macos path, link Matrix.framework to the project as a static library.
4. Add import , then you can use the performance probe tool of WeChat.
Start the plugins
In the following places:
Program main function;
application:didFinishLaunchingWithOptions: of AppDelegate;
Or other places running as earlier as possible after application launching.
Add a code similar to the following to start the plugin:
objective-c
import
Matrix matrix = [Matrix sharedInstance];
MatrixBuilder curBuilder = [[MatrixBuilder alloc] init];
curBuilder.pluginListener = self; // get the related event of plugin via the callback of the pluginListener
WCCrashBlockMonitorPlugin crashBlockPlugin = [[WCCrashBlockMonitorPlugin alloc] init];
[curBuilder addPlugin:crashBlockPlugin]; // add lag and crash monitor.
WCMemoryStatPlugin memoryStatPlugin = [[WCMemoryStatPlugin alloc] init];
[curBuilder addPlugin:memoryStatPlugin]; // add memory monitor.
WCFPSMonitorPlugin fpsMonitorPlugin = [[WCFPSMonitorPlugin alloc] init]