Popularity
7.8
Stable
Activity
9.1
Stable
1,865
65
222

Description

AndroidGodEye is a performance monitor tool for Android(not limited to performance data) , you can easily monitor the performance of your app in real time in pc browser.

It is divided into 3 parts:

Core provide all performance modules and produce performance datas. Debug Monitor provide a dashboard to show these performance datas. Toolbox make developers easy to use this library. AndroidGodEye prodive several modules, such as cpu, heap, block, leak memory and so on.

Programming language: Java
Latest version: v2.8.0

AndroidGodEye alternatives and similar packages

Based on the "Performance_Analysis_Tools" category

  • MAT

    The Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.

Do you think we are missing an alternative of AndroidGodEye or a related project?

Add another 'Performance_Analysis_Tools' Package

README

AndroidGodEye

English README.md    中文 README_zh.md

Android developer lack of monitoring of performance data,especially in production environment. so we need "AndroidGodEye".

Overview

[android_godeye_connect](ART/android_god_eye_connect.jpg)

AndroidGodEye is a performance monitor tool for Android(not limited to performance data) , you can easily monitor the performance of your app in real time in pc browser.

It is divided into 3 parts:

  1. Core provide all performance modules and produce performance datas.
  2. Debug Monitor provide a dashboard to show these performance datas.
  3. Toolbox make developers easy to use this library.

AndroidGodEye prodive several modules, such as cpu, heap, block, leak memory and so on.

Quickstart

Demo APK

Demo Project:https://github.com/Kyson/AndroidGodEyeDemo

Step1 Dependencies

Module Project build.gradle

dependencies {
  implementation 'cn.hikyson.godeye:godeye-core:VERSION_NAME'
  debugImplementation 'cn.hikyson.godeye:godeye-monitor:VERSION_NAME'
  releaseImplementation 'cn.hikyson.godeye:godeye-monitor-no-op:VERSION_NAME'
  implementation 'cn.hikyson.godeye:godeye-toolbox:VERSION_NAME'
}

Find VERSION_NAME in Github release

Root Project build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "cn.hikyson.methodcanary:plugin:PLUGIN_VERSION_NAME"
    }
}

Find PLUGIN_VERSION_NAME in MethodCanary github release

You need to config the logic of method canary injection, create js file:MethodCanary.js in project root dir, content like following:

/**
    classInfo
        {int access
         String name
         String superName
         String[] interfaces}

     methodInfo
         {int access
         String name
         String desc}
**/
function isExclude(classInfo,methodInfo){
    return false
}

function isInclude(classInfo,methodInfo){
    return classInfo.name.startsWith('cn/hikyson/godeyedemo'))
}

More configurations reference: MethodCanary

Module Project 'com.android.application' build.gradle

apply plugin: 'cn.hikyson.methodcanary.plugin'

Step2 Initialize And Install Modules

Init first in your application:

GodEye.instance().init(this);

Install modules in application onCreate, GodEye class is entrance for this step, all modules are provided by it.

if (ProcessUtils.isMainProcess(this)) {//install in main process
    GodEye.instance().install(GodEyeConfig.fromAssets("android-godeye-config/install.config"));
}

assets目录下放模块的配置文件android-godeye-config/install.config,内容如下:

<config>
    <battery />
    <cpu intervalMillis="2000" sampleMillis="1000"/>
    <crash crashProvider="cn.hikyson.godeye.core.internal.modules.crash.CrashFileProvider"/>
    <fps intervalMillis="2000"/>
    <heap intervalMillis="2000"/>
    <leakMemory debug="true" debugNotification="true" leakRefInfoProvider="cn.hikyson.godeye.core.internal.modules.leakdetector.DefaultLeakRefInfoProvider"/>
    <pageload pageInfoProvider="cn.hikyson.godeye.core.internal.modules.pageload.DefaultPageInfoProvider"/>
    <pss intervalMillis="2000"/>
    <ram intervalMillis="2000"/>
    <sm debugNotification="true"
        dumpIntervalMillis="1000"
        longBlockThresholdMillis="500"
        shortBlockThresholdMillis="300"/>
    <thread intervalMillis="3000"
            threadFilter="cn.hikyson.godeye.core.internal.modules.thread.SimpleThreadFilter"/>
    <traffic intervalMillis="2000" sampleMillis="1000"/>
    <methodCanary maxMethodCountSingleThreadByCost="300" lowCostMethodThresholdMillis="10"/>
</config>

Optional Uninstall Modules

Uninstall modules when you don't need it(not recommend):

GodEye.instance().uninstall();

Note that network and startup module don't need install and uninstall.

When install finished, GodEye begin produce performance data, generally you can call consume of modules to get these datas, for example:

GodEye.instance().<Cpu>getModule(GodEye.ModuleName.CPU).subject().subscribe()

Just like we will mention later,Debug Monitor is one of these consumers.

Step3 Install Performance Visualization Dashboard

GodEyeMonitor class is entrance for this step.

Start performance visualization dashboard:

GodEyeMonitor.work(context)

Stop it:

GodEyeMonitor.shutDown()

Install IDE Plugin

Install Android Studio plug-in(Search AndroidGodEye in Android Studio plugin setting),Then you can find AndroidGodEye in main toolbar,click it and it will open dashboard in browser.

https://github.com/Kyson/AndroidGodEye/blob/master/ART/android-godeye-plugin-position.png

Connect mobile phones and computers with USB, run adb forward tcp:5390 tcp:5390, then open http://localhost:port/index.html(Note that /index.html is necessary!!!) on PC. If you don't have a USB, you can also open http://mobile ip:port/index.html directly, ensure that mobile phones and PC are in the same LAN segment of course.

Default port is 5390, you can find ip in logcat output after call GodEyeMonitor.work(context,port), log is like:'Open AndroidGodEye dashboard [ http://ip:port/index.html" ] in your browser...'.

Now enjoy it!

Performance Visualization Dashboard

Click ↓ to preview

MethodCanary

[android_god_eye_dashboard1](ART/android_god_eye_dashboard1.png)

Fps/RAM/PSS/Battery...

[android_god_eye_dashboard2](ART/android_god_eye_dashboard2.png)

Cpu/Heap/Traffic...

[android_god_eye_dashboard3](ART/android_god_eye_dashboard3.png)

Leak Memory/App Jank(Block)

[android_god_eye_dashboard4](ART/android_god_eye_dashboard4.png)

Leak Memory GIF

[android_god_eye_leak](ART/android_god_eye_leak.gif)

Jank(Block) GIF

[android_god_eye_block](ART/android_god_eye_block.gif)

Page Lifecycle(Page Load)/Network

[android_god_eye_dashboard5](ART/android_god_eye_dashboard5.png)

Page Lifecycle(Page Load) GIF

[android_god_eye_pageload](ART/android_god_eye_pageload.gif)

Network GIF

[android_god_eye_network](ART/android_god_eye_network.gif)

Network Detail

[android_god_eye_dashboard6](ART/android_god_eye_dashboard6.png)

Thread

[android_god_eye_dashboard7](ART/android_god_eye_dashboard7.png)

Modules

模块名 需要安装 数据生产时机 配置 备注
network 外部输入时输出 -
startup 外部输入时输出 -
battery 电池变化时输出 -
cpu 定时输出 intervalMillis-每隔x毫秒输出数据,sampleMillis-采样间隔 系统版本大于8.0失效
crash 安装后,输出上次崩溃 crashProvider-实现CrashProvider的类path,一般用内置cn.hikyson.godeye.core.internal.modules.crash.CrashFileProvider即可 -
fps 定时输出 intervalMillis-输出间隔 -
heap 定时输出 intervalMillis-输出间隔 -
leakDetector(leakMemory) 页面销毁且泄漏时 debug-是否需要解析gc引用链,debugNotification泄漏时是否需要通知,leakRefInfoProvider-实现LeakRefInfoProvider的类path,一般用内置cn.hikyson.godeye.core.internal.modules.leakdetector.DefaultLeakRefInfoProvider -
pageload 页面create/draw/destory/load/hide/show等输出 pageInfoProvider-根据页面实例提供页面信息 fragment的显示隐藏需要手动调用show hide api,页面加载手动调用load api
pss 定时输出 intervalMillis-输出间隔 -
ram 定时输出 intervalMillis-输出间隔 -
sm 卡顿时输出 debugNotify-卡顿是否需要通知,dumpIntervalMillis-dump堆栈间隔,longBlockThresholdMillis-长卡顿阈值,shortBlockThresholdMillis-短卡顿阈值 -
thread 定时 intervalMillis-输出间隔,threadFilter-过滤器,实现ThreadFilter类path,一般用内置cn.hikyson.godeye.core.internal.modules.thread.SimpleThreadFilter即可 -
traffic 定时输出 intervalMillis-输出间隔,sampleMillis-采样间隔 -
methodCanary 停止后输出 maxMethodCountSingleThreadByCost-每个线程最多记录的方法数,lowCostMethodThresholdMillis-方法耗时阈值 -

Framework

How does AndroidGodEye work?As below:

[android_god_eye_framework_2](ART/android_god_eye_framework_2.jpg)

License

AndroidGodEye is under Apache2.0.

Contributors

About Me


*Note that all licence references and agreements mentioned in the AndroidGodEye README section above are relevant to that project's source code only.