GPU Debugger

GPU Debugging Tools

The GPU debugging tools are an experimental feature intended to help inspect GPU state and understand what caused a specific rendering outcome.

Installing the GPU Debugging Tools

The GPU Debugging Tools are not installed by default; you’ll need to add it before you can use it.  You can find them in the SDK tools section of your SDK manager:

Adding the trace library to your application

In order to use the profiler, you need to load the trace library in your application.  The correct way to load the library depends on whether your code is C++ or Java.   The library can be loaded via either method in a hybrid app.

Regardless of which way you load the library, you first need to copy it into your project so that it can be loaded.  The trace library will be located inside your SDK installation.  You can find your SDK installation path location listed at the top of your SDK Manager.  The libraries will be located in <sdkDir>/extras/android/gapid/android/<abi>/libgapii.so.  

You need to copy the relevant abi folders into your project’s jniLibs directory.  This will be at <projectDir>/app/src/main/jniLibs.  If it doesn’t already exist, you should create it.  Like the SDK manager folder, jniLibs should contain one folder per ABI that you plan to support.  If you don’t know which ABIs you plan to support, you can copy all of the folders.  Your final project directory structure should look like <projectDir>/app/src/main/jniLibs/<abi>/libgappii.so.

Loading the trace library in native code

To load the trace library in native code, create a .cpp file containing this snippet:

#include <android/log.h>

#include <dlfcn.h>

#define PACKAGE_NAME "" // Fill this in with the actual package name

#define GAPII_SO_PATH "/data/data/" PACKAGE_NAME "/lib/libgapii.so"

struct GapiiLoader {

GapiiLoader() {

if (!dlopen(GAPII_SO_PATH, RTLD_LOCAL | RTLD_NOW)) {

__android_log_print(ANDROID_LOG_ERROR, "GAPII", "Failed loading " GAPII_SO_PATH);

}

}

};

GapiiLoader __attribute__((used)) gGapiiLoader;

Loading the trace library in Java code

To load the trace library into Java code, insert this snippet into your main class:

static {

System.loadLibrary("gapii");

}

Running a trace

Note that once you add the trace library, your application will block on startup until it can connect to the Android Studio trace receiver.  This will render your application useless outside of debugging contexts, so be sure to remove the trace library from your application when you’re done with the profiler.

To start a trace, deploy and run your app as normal.  It should load with a blank screen while it waits for the trace receiver; to enable the receiver, go to the CPU/GPU tab of the Android Monitor.  Click the red trace button on the left side of the GPU subtab:

Once you begin tracing, your application should unblock and proceed as normal.  As you interact with it, all GPU data will be captured by the trace.  When you’re done capturing data, click the trace button again to stop the trace.  As soon as the trace has finished being written to the file, it will be opened ready for inspection.

Reading trace results

Traces will be logged to a new captures folder inside your project.  When you open a trace, the top bar of the UI will show the full sequence of logged frames.   You can select an individual frame via either the top bar or the GPU commands panel; once you select a frame, the center right framebuffer window will update to show that frame’s contents.   If you expand the frame on the lefthand GPU commands window, you’ll see the individual draw commands and GL calls that were used.

If you click on a draw command, the framebuffer preview will be updated to reflect the contents as of that draw call.  As applicable, the memory window in the lower right will also be updated to show relevant memory state at the time of the call.

At any point, you can use the GPU State window or the Textures tab to explore relevant GPU state at the time of your selected frame or draw calls.

If you run into issues, please help us improve the 2.0 release by logging bugs in our public Issues Tracker. You can create an issue via this link or by clicking on Help → Submit Feedback directly in Android Studio.

android studio 2.0 GPU Debugger使用说明的更多相关文章

  1. Android Studio 3.0 下载 使用新功能介绍

    谷歌2017发布会更新了挺多内容的,而且也发布了AndroidStudio3.0预览版,一些功能先睹为快.(英语一般,有些翻译不太好) 下载地址 https://developer.android.g ...

  2. Android Studio 2.0 正式版公布啦 (首次中文翻译)

    Android Studio 2.0 公布了,添加了一些新特性: 1. 更加完好的 Instant Run 2. 更快的 Android Emulator 3.GPU Debugger Preview ...

  3. Android Studio 2.0 稳定版新特性介绍

    Android Studio 2.0 最终迎来了稳定版本号,喜大普奔. 以下这篇文章是2.0新特性的一些简介. 假设想看具体内容请看这里<Android Studio有用指南> 文章转自这 ...

  4. 当一回Android Studio 2.0的小白鼠

    上个星期就放出了Android studio出2.0的消息,看了一下what's new 简直抓到了那个蛋疼的编译速度痛点.在网上稍微搜索了一下后发现基本都是介绍视频.一番挣扎后(因为被这IDE坑过几 ...

  5. Android Studio 3.0 新特性

    最新Android Studio版本是Android Studio 3.0,本文提供了所有新功能和更改的摘要. 所有这些功能都可以在最新的金丝雀版本中发布,但beta测试版本可能尚未提供. 核心IDE ...

  6. Android Studio 2.0使用指南

    一.下载界面.[无激活码 无序列码 无毒请放心使用][需将JAVA程序升级到1.8] 网址:http://www.android-studio.org/index.php/download/andro ...

  7. Android Studio 1.0.2项目实战——从一个APP的开发过程认识Android Studio

    Android Studio 1.0.1刚刚发布不久,谷歌紧接着发布了Android Studio 1.0.2版本,和1.0.0一样,是一个Bug修复版本.在上一篇Android Studio 1.0 ...

  8. Android Studio 1.0.1 + Genymotion安卓模拟器打造高效安卓开发环境

    我们开发安卓大多是使用Eclipse和安卓SDK中自带的安卓模拟器.当然,Google早就推出了自己的安卓开发环境——Android studio,在不久前,Google发布了Android Stud ...

  9. [Android] 环境配置之正式版Android Studio 1.0

    昨天看见 Android Studio 1.0 正式版本发布了:心里挺高兴的. 算是忠实用户了吧,从去年开发者大会一开始出现 AS 后就开始使用了:也是从那时开始就基本没有用过 Eclipse 了:一 ...

随机推荐

  1. go:匿名函数与闭包

    一.匿名函数 定义:没有函数名的函数. 作用:在go语言中目前了解的作用就是用于构成闭包. *注:由于javascript不存在块级作用域,故匿名函数常用来包含代码以不污染全局命名空间,运行后销毁环境 ...

  2. 常用语句if,for,while

    一.变量赋值 a = 3 b = a a = 5 print a,b 5,3   变量命名规则:   1.显式 2.nums_of_alex_gf = 19 3.NumsOfAlexGf = 2 4. ...

  3. HTML5本地数据库(SQLite)示例

    本文转载自http://blog.sina.com.cn/s/blog_641cf27f01016pm5.html 按照国内一HTML5先行者的例子仿写了一个用HTML5 API来操作本地SQLite ...

  4. Spring中bean的作用域scope详解

    参考文献:http://blog.csdn.net/jacklearntech/article/details/40157861 http://www.cnblogs.com/qq78292959/p ...

  5. MyEclipse Project Migration功能中文简单介绍

    前端时间,我对myEclispe的project Migration产生了疑问,也不知道是干啥用的.然后百度之,翻译结果是项目迁移,再次百度其他人对这个的经验,没想到百度到的没多少,甚至都没有说明这个 ...

  6. 联合体(union)的使用方法及其本质

    转自:http://blog.csdn.net/huqinwei987/article/details/23597091 有些基础知识快淡忘了,所以有必要复习一遍,在不借助课本死知识的前提下做些推理判 ...

  7. ppt - 常规策划

    1 比较图2 progress3 目标 proposal4 market leadership5 分析 - 设计 - 开发 - 实施 - 评估6 innovation7 时间区间表述8 阶梯式9 主 ...

  8. 常见开发需求之前端利器webstorm中的git和快捷键

    需求   前端开发中我们最常用的一般是webstorm.hbuilder和sublime,因为以前使用过一段时间eclipse所以我对webstorm的感觉比较良好,再加上以前使用hbuilder维护 ...

  9. 【转】C#中WinForm程序退出方法技巧总结

    C#中WinForm程序退出方法技巧总结 一.关闭窗体 在c#中退出WinForm程序包括有很多方法,如:this.Close(); Application.Exit();Application.Ex ...

  10. python安装库

    首先确保安装了pip,并且pip也加入了系统path路径: pip下载:https://pypi.python.org/pypi/pip#downloads 下载Python对应的包:(http:// ...