Advanced usage

The following sections outline advanced usage topics not needed for normal operation of the library.

Other supported tracers

Tuning Fork supports multiple tracers. Tracers with the following instrument keys are supported:

  • Time between frame starts (called PACED_FRAME_TIME)
  • CPU Time: Time between the start of the frame and the end of the CPU work for the frame (called CPU_TIME)
  • GPU Time: Time for the previous frame to be handled by the GPU (called GPU_TIME)
  • The raw frame time, defined as the maximum of the CPU and GPU time (called RAW_FRAME_TIME). The difference between this option and PACED_FRAME_TIME is that this option does not include any wait time included by Swappy or VSync.

You can find these instrument keys in the reference documentation. Some of these keys are used automatically when you enable the Android Frame Pacing library, but if you are not enabling this library, you should use them explicitly.

Get fidelity parameters

TFErrorCode TuningFork_getFidelityParameters(const CProtobufSerialization* defaultParams, CProtobufSerialization* params, uint32_t timeout_ms);

If you pass fidelity_params_callback to TuningFork_init in settings or the library is in scaled mode, you do not need to call this function.

This function contacts a server to retrieve fidelity parameters. It blocks until one of the following occurs:

  • Fidelity parameters are retrieved, with a return value of TFERROR_OK and returnedParams store the parameters. In this case, all subsequent tick data is associated with returnedParams.
  • A number of milliseconds equal to timeout_ms passes, with a return value of TFERROR_TIMEOUT. In this case, all subsequent tick data is associated with defaultFidelityParams.

You must call TuningFork_init() before this function, and you must call it on a separate thread from the main thread (see TuningFork_startFidelityParamDownloadThread() for a utility function that does this for you). You can call this function again, for example at level-loading time, to retrieve fidelity parameters from the server again. This allows you to dynamically update parameters rather than having to reload them only at start-up. If new fidelity parameters are downloaded or a new default is used, all previous tick data is submitted.