Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/knight-zxw/blockcanaryx

🔥基于堆栈采样,使用函数火焰图的形式展示Android Main Looper的慢消息处理过程,定位阻塞原因
https://github.com/knight-zxw/blockcanaryx

android-blocking-detect apm blockcanary

Last synced: about 1 hour ago
JSON representation

🔥基于堆栈采样,使用函数火焰图的形式展示Android Main Looper的慢消息处理过程,定位阻塞原因

Awesome Lists containing this project

README

        

## BlockCananry [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.knight-zxw/blockcanary/badge.svg?style=flat)](https://github.com/Knight-ZXW/BlockCanaryX)

该库通过监听主线程Looper的消息处理时间,并通过stackSampler定时采样主线程的堆栈,当检测
到主线程Looper消息慢处理时,会通过`Notification`的方式告知用户,当用户点击卡顿详情时,
会跳转到一个Web页面,以火焰图的形式展示消息处理时间内的函数运行情况

## 项目说明
1.本项目的初衷是为了介绍 https://juejin.cn/post/7107137302043820039 这篇文章的内容。

## 功能界面





## 引入
```gradle
dependencies {
//引入卡顿监控实现依赖库
implementation 'io.github.knight-zxw:blockcanary:${latestVersion}'
//引入卡顿消息通知及相关展示UI
implementation 'io.github.knight-zxw:blockcanary-ui:${latestVersion}'

// 如果你只想在debug包引入,不希望被引入release包,可以使用 debugImplementation
//debugImplementation 'io.github.knight-zxw:blockcanary:${latestVersion}'
}
```

## 使用方法
默认情况下,blockcanary 基于androidx 的startup框架,会自动进行初始化。
如果需要个性化配置,则需要通过 在res/values 下配置资源值的方式 关闭自动化初始化
```
false
```

手动初始化的示例代码
```java
// 一般在 application onCreate阶段配置
val blockCanaryConfig = BlockCanaryConfig.newBuilder().build()
BlockCanary.install(application,blockCanaryConfig)
```
## 待支持功能/优化
- [ ] 卡顿消息支持一键清除、过期自动清除
- [ ] 记录消息处理消耗的cpu时间
- [ ] 记录慢消息执行时,所在的前台Activity, APP的状态、
- [ ] 支持Native 抓栈能力

## Stargazers over time

[![Stargazers over time](https://starchart.cc/Knight-ZXW/BlockCanaryX.svg)](https://starchart.cc/Knight-ZXW/BlockCanaryX)