Skip to content
Proyectos

Acerca de

🔥 Mediante muestreo de pilas, muestra el procesamiento lento de mensajes del Android Main Looper como un gráfico de llamas de funciones para localizar la causa de los bloqueos.

Otros proyectos

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

BlockCananry Maven Central

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

项目说明

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

功能界面

引入

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 下配置资源值的方式 关闭自动化初始化

<item name="block_canary_auto_install" type="bool">false</item>

手动初始化的示例代码

// 一般在 application onCreate阶段配置
val blockCanaryConfig = BlockCanaryConfig.newBuilder().build()
BlockCanary.install(application,blockCanaryConfig)

待支持功能/优化

  • 卡顿消息支持一键清除、过期自动清除
  • 记录消息处理消耗的cpu时间
  • 记录慢消息执行时,所在的前台Activity, APP的状态、
  • 支持Native 抓栈能力

Stargazers over time

Explorar proyectos relacionados

Cargando…