All Projects → zkwlx → Adi

zkwlx / Adi

Licence: apache-2.0
ADI(Android Debug Intensive) 是通过 JVMTI 实现的 Android 应用开发调试的增强工具集,目前主要提供性能相关的监控能力。

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Adi

vaper
Take a look at the relations among servers.
Stars: ✭ 16 (-91.75%)
Mutual labels:  monitor, apm
App perf
Open source application performance monitoring tool with emphasis on ease of setup and use. Providing similar functionality like NewRelic/AppNeta/Skylight etc.
Stars: ✭ 353 (+81.96%)
Mutual labels:  monitor, apm
Oknetworkmonitor
A network monitor for OkHttp.
Stars: ✭ 204 (+5.15%)
Mutual labels:  monitor, apm
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+1075.77%)
Mutual labels:  monitor, apm
Sentry
Sentry is cross-platform application monitoring, with a focus on error reporting.
Stars: ✭ 29,700 (+15209.28%)
Mutual labels:  monitor, apm
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+2311.34%)
Mutual labels:  thread, apm
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (+41.24%)
Mutual labels:  thread, monitor
Prism
Application Performance Management & Monitoring for iOS (APM)
Stars: ✭ 67 (-65.46%)
Mutual labels:  monitor, apm
Androidperformancemonitor
A transparent ui-block detection library for Android. (known as BlockCanary)
Stars: ✭ 6,241 (+3117.01%)
Mutual labels:  monitor, apm
Uavstack
UAVStack Open Source All in One Repository
Stars: ✭ 648 (+234.02%)
Mutual labels:  monitor, apm
Mthawkeye
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)
Stars: ✭ 1,119 (+476.8%)
Mutual labels:  monitor, apm
Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 148 (-23.71%)
Mutual labels:  apm, jni
Urlwatch
urlwatch monitors webpages for you
Stars: ✭ 2,294 (+1082.47%)
Mutual labels:  monitor
Lunar
Intelligent adaptive brightness for your external monitors
Stars: ✭ 2,712 (+1297.94%)
Mutual labels:  monitor
Java Concurrency Examples
Java Concurrency/Multithreading Tutorial with Examples for Dummies
Stars: ✭ 173 (-10.82%)
Mutual labels:  thread
Pinpoint C Agent
It is an agent written by C++, PHP, python languages. And we hope to support other languages by this agent. Until now, it supports [PHP],[C/C++] and [PYTHON].
Stars: ✭ 188 (-3.09%)
Mutual labels:  apm
Sand
Using JNI to achieve Sobel operator image edge detection使用JNI实现Sobel算子图像边缘检测,支持kotlin https://github.com/Jomes/sand
Stars: ✭ 186 (-4.12%)
Mutual labels:  jni
Scapix
Scapix Language Bridge
Stars: ✭ 171 (-11.86%)
Mutual labels:  jni
Sobjectizer
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.
Stars: ✭ 172 (-11.34%)
Mutual labels:  thread
Nevergreen
🐤 A build monitor with attitude
Stars: ✭ 170 (-12.37%)
Mutual labels:  monitor

ADI 简介

(For english )

对象分配与释放的样例

对象分配图表 点击体验
多线程竞争样例

线程竞争图表 点击体验
APP 集成样例截图

ADI 控制窗

ADI(Android Debug Intensive) 是通过 JVMTI 实现的 Android 应用开发调试的增强工具集,目前主要提供性能相关的监控能力。
ADI 对运行时的 App 进行性能数据收集,并提供工具用于生成分析图表。目前提供如下功能:

  • 监控 ART 运行过程中对象的分配与释放,包括对象大小、创建对象调用栈等信息
  • 监控 ART 运行过程中多线程之间的锁竞争,包括发生竞争时的调用栈、当前竞争线程的等待时长、当前持有锁的线程等信息

注意 ADI 只支持 Android 8.0(包括 8.0)之后的系统。

如何使用

集成到 APP

首先添加 jcenter 依赖(添加过请忽略):

buildscript {
    repositories {
        jcenter()
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

然后 APP 工程集成 adi 库:

debugImplementation 'zkw.adi:adi:0.9.3'
releaseImplementation 'zkw.adi:adi-nop:0.9.3'

生成 Log 文件

集成 adi 库之后便能够对 App 进行性能数据采集,采集方式有两种。

方法一,使用 start/stop 接口

具体代码如下

// 首先进行初始化
ADIManager.init(context)
...
// 在任何想开始采集的地方添加如下代码
val builder = ADIConfig.Builder()
builder.setEventType(ADIConfig.Type.THREAD_MONITOR_CONTEND)// 设置要监控的事件类型
ADIManager.start(activity, builder.build())
...
// 在任何停止采集的地方添加如下代码
ADIManager.stop()
方法二,可交互的悬浮控制窗

控制窗可以在不重新编译的情况下更改 ADI 配置,下面代码展示如何启动控制窗

// 在 Activity 中调用
ADIFloatManager.showADIFloat(activity)

控制窗的使用方法情参考图解

控制窗图解

解析 Log 文件并生成图表

采集的内容存放在 Context.getExternalCacheDir()/ADI 目录下,例如

/sdcard/Android/data/APP 包名/cache/ADI/adi_1570605092.log

取出 log 文件后,需要用adi-analyzer工具分析 log 并生成图表,通过 pip3 安装:

pip3 install adi-analyzer

之后运行 adi-analyzer 并将 log 文件传入:

adi-analyzer ~/adi_1570605092.log

adi-analyzer 会创建 .html 结尾的图表文件,之后会自动启动浏览器打开图表文件,图表效果请参考封面。

功能详解

对象分配监控

在监控对象分配时,ADI 会监控所有 Java 层对象的创建事件,有几点需要注意:

  • 频繁创建对象可能会导致 App 卡顿甚至卡死,可以通过 ADIConfig.sampleIntervalMs 或控制窗配置采样间隔(默认 0.8ms)
  • 调用栈的深度默认是 10,可以通过 ADIConfig.stackDepth 或控制窗修改
  • 如果生成的 Log 文件过大会严重影响图表生成时间,此时建议增加采样间隔或减少整体采样时长

ADI 会为对象事件的 Log 生成两个图表:对象分配数量图表和对象分配大小图表。下面用对象分配数量图表介绍下图表的使用方式。 图表图解

点击体验

多线程竞争监控

在监控多线程竞争时,ADI 会监控所有 Java 层 synchronized 关键字导致的多线程锁竞争事件,以下几点需要注意:

  • 调用栈的深度默认是 10,可以通过 ADIConfig.stackDepth 或控制窗修改
  • 如果生成的 Log 文件过大会严重影响图表生成时间,此时建议减少采样时长

多线程竞争图表的 Y 轴是发生竞争的线程名字,X 轴是时间,具体说明请看图解。 图表图解

点击体验

License

Copyright 2019 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].