MyGit

happylishang/Collie

Fork: 62 Star: 303 (更新于 2024-11-04 03:50:03)

license: 暂无

Language: Kotlin .

Android APM Online 线上轻量级APM 性能监测 Android性能监控 性能

最后发布版本: 1.1.8 ( 2022-08-30 15:44:55)

GitHub网址

Collie

轻量级Android性能监测工具

  • FPS监测及卡顿监测: 利用Looper的printLoop来实现
  • 流量监测: Trafficstats
  • 耗电 :Battery BroadCast 似乎意义不是特别大
  • 内存占用:Debug
  • 内存泄漏:weakHashMap
  • 启动耗时:ContentProvier+onwindforcus

技术文档:Android线上轻量级APM性能监测方案

使用方法 mavenCenter

app的build.gradle添加

    implementation 'io.github.happylishang:collie:1.1.8'
  

Application中添加

       Collie.getInstance().init(this, new Config(true, true, true, true, true, true), new CollieListener() {

            @Override
            public void onTrafficStats(Activity activity, long value) {
                Log.v("Collie", "" + activity.getClass().getSimpleName() + " 流量消耗 " + value * 1.0f / (1024 * 1024) + "M");

            }

            @Override
            public void onBatteryCost(BatteryInfo batteryInfo) {
                Log.v("Collie",  " 电量流量消耗 " +batteryInfo.cost);

            }

            @Override
            public void onAppColdLaunchCost(long duration ,String processName) {
                Log.v("Collie", "启动耗时 " + duration +" processName "+processName);
            }

            @Override
            public void onActivityLaunchCost(Activity activity, long duration,boolean finishNow) {
                Log.v("Collie", "activity启动耗时 " + activity + " " + duration + " finishNow "+finishNow);
            }

            @Override
            public void onLeakActivity(String activity, int count) {
                Log.v("Collie", "内存泄露 " + activity + " 数量 " + count);
            }

            @Override
            public void onCurrentMemoryCost(TrackMemoryInfo trackMemoryInfo) {
                Log.v("Collie", "内存  " + trackMemoryInfo.procName + " java内存  "
                        + trackMemoryInfo.appMemory.dalvikPss + " native内存  " +
                        trackMemoryInfo.appMemory.nativePss);
            }

            @Override
            public void onFpsTrack(Activity activity, long currentCostMils, long currentDropFrame, boolean isInFrameDraw, long averageFps) {
                if (currentDropFrame >= 2)
                    Log.v("Collie", "Activity " + activity + " 掉帧 " + currentDropFrame + " 是否因为Choro 绘制掉帧 " + isInFrameDraw + " 1s 平均帧率" + averageFps);
            }

            @Override
            public void onANRAppear(Activity activity) {
                Log.v("Collie", "Activity " + activity + " ANR  " );

            }
        });
    }	   
    

最近版本更新:(数据更新于 2024-09-15 01:29:33)

2022-08-30 15:44:55 1.1.8

happylishang/Collie同语言 Kotlin最近更新仓库

2024-11-19 23:12:26 jellyfin/jellyfin-androidtv

2024-11-18 20:14:29 gkd-kit/gkd

2024-11-11 21:37:35 FooIbar/EhViewer

2024-11-01 20:22:27 EhViewer-NekoInverter/EhViewer

2024-11-01 16:15:30 tiann/KernelSU

2024-10-27 19:26:53 salvogiangri/KnoxPatch