android studio 2.0 GPU Debugger使用说明
2016-04-20 13:01
441 查看
GPU Debugger
GPU Debugging ToolsThe 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 ToolsThe 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 applicationIn 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 codeTo 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 codeTo load the trace library into Java code, insert this snippet into your main class:static { System.loadLibrary("gapii"); } Running a traceNote 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 resultsTraces 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.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中ViewPager的使用(二):实现图片轮播效果
- Android 使用VDPlayerSDK组件实现播放视频(二)
- Android 加密 MD5和Base64简单介绍
- Android屏幕适配全攻略
- Android 混淆打包时第三方jar包报错Unknown verification type [*] in stack map frame
- mac android studio 离线文档
- Android应用程序管理服务启动过程浅析(PackageManagerService)
- AndroidViewPager的使用(一)
- Android中的自定义注解(反射实现-运行时注解)
- Android倒计时案例展示
- 后台基于SSH框架开发的Android应用的前后台数据交互
- android studio 插件
- ViewPager实现Android向导页
- android 布局文件明明存在,却报错
- 百度地图android端URL.api直接展示地图处理
- OpenCV学习笔记(四)—— OpenCV for Android移植到Android平台
- Android开源项目合集
- Android源码解析合集
- Android框架知识合集
- Android使用MediaRecorder类进行录制视频