Giter Club home page Giter Club logo

blockcanaryx's Introduction

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

Stargazers over time

blockcanaryx's People

Contributors

knight-zxw avatar light-echo-3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.