Matrix is an APM (Application Performance Manage) developed by wechat and used daily. Currently, it is mainly running on Android platform. Matrix aims to establish a unified application performance access framework, quickly integrate various performance monitoring schemes, collect and analyze abnormal data of performance monitoring items, and output corresponding problem analysis, positioning and optimization suggestions, so as to help developers develop higher-quality applications.

After more than one year of verification and iteration in wechat, Matrix is now open source:

https://github.com/tencent/matrix 

Welcome Star, Mention Issue and PR.

What does Matrix do?

The current monitoring scope of Matrix includes: application installation package size, SQLite operation optimization, frame rate variation, lag, startup time, page switching time, slow method, file read and write performance, I/O handle leak, memory leak, etc.

APK Checker 

APK Checker is an analysis and detection tool for Android installation packages. It checks for specific problems in APK based on a set of rules and generates detailed detection results for troubleshooting and version tracking. Currently, APK Checker includes the following features:

  • Read the manifest information

  • Lists all files in APK sorted by file size

  • Number of statistical methods

  • Counting classes

  • Check for resource obfuscation (AndResguard)

  • Search for PNG files without alpha channels

  • Search for uncompressed file types

  • Check for dynamic libraries with multiple ABI versions

  • Count the R class contained in APK and the field count in R class

  • Search for redundant files

  • Check if there are multiple dynamic libraries statically linked to the STL

  • Search for unwanted resources contained in APK

  • Search for useless assets files contained in APK

  • Search for untrimmed dynamic libraries in APK

SQLite Lint

SQLite Lint is an automated tool for checking the quality of SQLite usage, just as an SQLite optimizer takes the time to review your SQL statements carefully during development or testing, and is a useful tool for your team’s high quality SQLite practice. Detection capabilities currently supported by SQLite Lint include:

  • Detect index usage problems

  • Detect redundant index problems

  • Detect select * issues

  • Detect an Autoincrement problem

  • Prepared statement is recommended

  • Detection is recommended using the Without Rowid feature

Trace Canary 

Trace Canary implements a high accuracy, high performance stuck detection, positioning scheme through Choreographer callbacks, compile-time piling, and extends support for a number of other fluency metrics, including:

  • Interface fluency assessment

  • Caton positioning

  • ANR monitoring

  • Monitor application startup and interface switching time

Resource Canary 

Resource Canary is an Activity leak and Bitmap duplicate creation detection tool based on the Weak Reference feature and the Haha library. The detection and acquisition part is deployed on the client side, and the analysis part is deployed on the server side. By separating the logic of detection and analysis, the process of the tool is more friendly to continuous integration. Resource Canary currently contains the following features:

  • Detect a suspected leaking Activity and output its class name and reference chain

  • Detect duplicate Bitmap objects with exactly the same image data in memory and output their class names and reference chains

IO Canary 

IO Canary is a tool to help discover IO problems in the development, testing or grayscale stage. Currently, it mainly includes file IO monitoring and Closeable Leak monitoring. It provides the large scale MONITORING of IO to get a better idea. Specific functions include:

  • Check the I/O usage of the main thread

  • The read/write Buffer is too small

  • Detect repeated read operations

  • Detect Closeable Leak operations, including file read and write, cursor not closed in time, etc

What are the advantages of Matrix?

Compared to conventional APM tools, Matrix has the following features:

APK Checker

  • Better usability: Provided as a JAR package, it is easier to apply to continuous integration systems to track and compare changes between each APK release

  • More check and analysis functions: In addition to the function of APKAnalyzer, it also supports counting R classes contained in APK, checking whether there are multiple dynamic libraries statically linked to STL, searching useless resources contained in APK, and supporting custom check rules, etc

  • Output checks are more detailed: HTML for visualization, JSON for parsing, custom output, and more

SQLite Lint

  • Access simple, code non – intrusive

  • Data volume is independent of SQLite performance risks can be found during development and testing

  • The detection algorithm is based on best practices and controls SQLite quality to a high standard

  • The bottom layer is C++ implementation, support multi-platform extension

Resource Canary

  • The separation of the test and analysis sections facilitates continuous output of the analyzed test results without interrupting the automated test

  • The Hprof file generated by the detection part is pruned to remove most of the useless data and reduce the overhead of Hprof file transmission

  • Repeated Bitmap object detection is added to reduce memory consumption by reducing the number of redundant bitmaps

Trace Canary

  • The bytecode is dynamically modified at compile time and the execution time and call stack are recorded with high performance

  • Accurately locate the function where the delay occurs, and provide information such as execution stack, execution time, and execution times to help quickly solve the delay problem

  • Automatic coverage of lag, startup time, page switching, slow function detection and other fluency indicators

IO Canary

  • Access simple, code non – intrusive

  • Comprehensive monitoring of performance and leakage, know IO quality

  • Compatible with Android P

The future planning

  • Internal and external same, continuously improve the function, add new monitoring items, such as power, thread resources, memory monitoring and so on

  • Platform extension, provide iOS and other languages SDK

  • Build a complete cloud solution

Open source address

Matrix:  https://github.com/tencent/matrix

Please give Matrix a Star!

Welcome to submit your issue and PR