Performance Profiling

This section provides several tools to help you learn how to profile your native apps.

Android Systrace

Android Systrace is a low overhead and powerful tool that can analyze performance bottlenecks. To learn more about this tool, go to https://developer.android.com/studio/command-line/systrace

If you are using the command-line tool, the following command is an example on how to start the systrace for 5 seconds. ‘systrace.py -t 5 -b 8192 view gfx sched -a YOUR_PACKAGE_NAME’

Below is an example of a systrace result of one simple Wave VR native app.

_images/pp_01.png

Process 3145 is a classical native Wave VR application with three active threads.

  • WaveVsync is the runtime vsync thread activated once every frame to indicate the correct vsync timing for other threads.
  • WaveWarp thread is the runtime warp thread activated twice every frame to do timewarp and to export the final image to display.

Both these threads must run in correct timings and in stable time intervals to make sure that users have the best VR experience and do not see tearings or stutters.

You will probably call WVR_SubmitFrame in the main rendering thread, such as WVR_Render, and see the ‘Submit’ tag in this thread. To keep the poses stable and the images smooth, the app can only call submit once within a frame. You will see the tag ‘WaitWarp’ in the main rendering thread while the Wave runtime is waiting for the next frame to start. There might be also multiple rendering threads that are controlled by the app. Keep the load of these rendering threads as low as possible to make sure that the FPS will be high enough.

Logcat

Monitor an application’s FPS with the logcat tool from Android Studio or command line. The sample command to use this tool is

$adb logcat | grep FPS:

The key word of the FPS log is “FPS:” and the log will be printed once per second.

04-08 11:37:11.321 2522 2800 I svr : FPS: 58.34
04-08 11:37:11.321 2522 2800 I svr : FPS: 58.34

Performance HUD (VIVE Wave SDK 3.1.0 or later)

Performance Heads-Up Display lets developers monitor real-time performance of their apps while wearing the HMD. Although there might be a drop in FPS when using the Performance HUD, it is helpful in learning which scenes or operations in apps are using a lot of resource.

_images/pp_03.jpg

This feature is only supported on Native and Unity platforms, do not use if using Unreal Engine. To enable the Performance HUD, install the setting app of the Performance HUD.

You can find the setting app in: SDK/tools/wvr_performance_hud_setting.apk

To turn on or off the Performance HUD, use the following adb commands.

  • Turn on: adb shell setprop debug.wave.perfmonitor.mode 1
  • Turn off: adb shell setprop debug.wave.perfmonitor.mode 0

HUD items

Broken Line Graph The latest 30 seconds FPS record. Each scale mark represents for 3 seconds.
FPS “Frames per second”. The frame count per second that is submitted from the
render thread. This should be equal to the vSync rate in normal situations.
REUSE Reused frame count per second. When the system load grows, the FPS of the
render thread can not reach the warp thread’s FPS. The warp thread has to
“reuse” the previous submitted frames to reach the vSync rate.
TEARS Difference between the warp thread’s FPS and vSync rate. When the system
load grows, the FPS of the warp thread can not reach the vSync rate.
CPU/GPU_LV Set the CPU/GPU performance level by WVR_SetPerformanceLevels to
achieve better performance balance.