blockindigo

Project Url: dodola/blockindigo
Introduction: another ui-block detection library for Android base on Blockcanary
More: Author   ReportBugs   
Tags:

简介

之前在 Blockcanary 的 issue 里讨论过,使用 Blockcanary 监测细粒度的卡顿会产生很多日志。 另一方面 Blockcanary 和我们项目里所使用的日志系统有冲突。

所以直接把 Blockcanary 的日志采样机制和 UI 拿过来写了这个,是的你没有看错。

在此之前一直使用 Debug 的 MethodTrace 进行分析,好像会有效率问题,放弃使用了。

框架的原理使用的是黄油项...(Project Butter) 中的Choreographer来监测类似界面绘制时候的丢帧(Skipped Frame)情况。

原理具体可以参照:http://bugly.qq.com/blog/?p=166

使用


repositories {
    maven {
        url "http://dl.bintray.com/dodola/maven"
    }
}

compile 'com.dodola:blockindigo:1.0'
public class WatcherApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        BlockIndigo.install(this, new BlockCanaryContext());
    }
}
public class FragmentPagerActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scroll);

        BlockIndigo.get().start(this);
    }

       @Override
    protected void onDestroy() {
        super.onDestroy();
        BlockIndigo.get().stop();
    }

}

相关项目

blockcanary leakcanary

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools