如何使用 adb 命令将 Profile GPU 渲染显示为条形图?

abh*_*ank 1 android adb dumpsys

我正在尝试使用脚本自动执行我在定期开发时所做的一些任务。其中之一是打开和关闭 GPU 配置文件渲染。但是,我找不到显示/隐藏它的 adb 命令。

Ale*_* P. 5

Developer Options 中Profile GPU Rendering复选框控制系统属性的值:debug.hwui.profile

/**
  * System property used to enable or disable hardware rendering profiling.
  * The default value of this property is assumed to be false.
  *
  * When profiling is enabled, the adb shell dumpsys gfxinfo command will
  * output extra information about the time taken to execute by the last
  * frames.
  *
  * Possible values:
  * "true", to enable profiling
  * "visual_bars", to enable profiling and visualize the results on screen
  * "false", to disable profiling
  *
  * @see #PROFILE_PROPERTY_VISUALIZE_BARS
  *
  * @hide
  */
public static final String PROFILE_PROPERTY = "debug.hwui.profile";
Run Code Online (Sandbox Code Playgroud)

所以你可以使用setprop debug.hwui.profile visual_bars命令来启用和setprop debug.hwui.profile false禁用它。