# Tuning Fork main interface

The main interface to use Tuning Fork.

## Summary

| ### Enumerations ||
|---|---|
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga308b3d402fe99aa0339379ff58784b95` | enum |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga95c208a46264fa01dbf33288face46d1` | enum |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gaa210b4355a4d847067750b667d089663` | enum |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527{ https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ab81f4967e37ad1a2211e7bea821ad53e = 0, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a685c9e45812e18f2e6bac0a6ec5184ab = 1, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ab4cf0c3ae102e5ea3c59b8c0000054c3 = 2, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a8d130a18a43740a33b7b0abfe7c3c46f = 3, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ab5e522aaac9662bb32b01875ebfc5d6d = 4, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ac7e6088672f1acd9a22c4d0e65522a59 = 5, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ae7b6f204243674b498e85c21950ad739 = 6, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a223c3b94d5d08ffa2fbf5bbe58f9aab9 = 7, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a646c0bf6624147cbec7e582a4bdeab64 = 8, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ac2afdf40205cc220babc4b0b5f99cd81 = 9, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527aae4920cfa38de2723e7e087fec3a5fa5 = 10, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a9ca218e5553d54d55ffdd571a50d3160 = 11, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a423919905ecdea9a53f2f3888c827bf8 = 12, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a2184e9c74b73d7a96e29b3310d7904a6 = 13, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ae91e483aa269293f40a52745e3f6e2b6 = 14, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a2a84336fc51b9892877e785014d89c4e = 15, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a62070a6a67ac127f9cc9edcba9810e09 = 16, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ab02967a574dd0c048168352e55df6499 = 17, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ab17aa93ea1f50022e83abd96c66aacf0 = 18, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a4d3d1b872db01d361991fff29cdd2389 = 19, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a1e7640b1acb70e662cda1834b423a4d3 = 20, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a9f30702ae54f9426c1baf8d499b8f9e0 = 21, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ada8080ebf5a9a5b44d46e49aa4279636 = 22, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a2339b1698f12dd94e943da5fbb8aedc4 = 23, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a9244c0979352529216f9467607fd0eeb = 24, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527afbe792ca8ce88d28dc3af064332f2fcc = 25, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a430f21bba9a9e2c822dfc01c54473205 = 26, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a300eda6ded7e5138d8873ba727c32c86 = 27, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a2f209e8e7edbaadfba90c3f3c199f731 = 28, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527aec38d70aebda11523195a8e52dfa2386 = 29, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a75fee427984a345ee9cdb62c3c80e343 = 30, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a20776693821e5bc467e9b8dd96efc3fa = 31, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a24cf8b84421c3a0b9d25de7c7660fb32 = 32, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a52ac692b787a512eacbe75377b3ec6c7 = 33, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ad8f712a7cf9d469e640871433862423c = 34, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a0b4b85f3d7def4750decae2d28c8d16e = 35, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ae1ab3e5129a1a9a8e3cee1334e4098e0 = 36, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a3aec95c8c98714053c076f532e757427 = 37, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a4ae0ce587e3008619a7ac1c4a96c5ca1 = 38, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527a01324c434ee02edc0240e4f058f19993 = 39, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527aee1c7dcee2aac2c24ceda80dea8c1632 = 40, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga37de0aa93ae4d18dacdf21778a559527ac78cd8f96c73755c0332ed841de43cd9 = 41 }` | enumAll the error codes that can be returned by Tuning Fork functions. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga9c9bec82c87741f88e5bd18ae16f7753{ https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga9c9bec82c87741f88e5bd18ae16f7753aecbc626bc408b79098aed6d06e3a7571 = 64000, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga9c9bec82c87741f88e5bd18ae16f7753ac8060d3a64f5cf2e133eae82195a1c5f = 64001, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga9c9bec82c87741f88e5bd18ae16f7753a0072f92c7b7014496e880544a3f76330 = 64002, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gga9c9bec82c87741f88e5bd18ae16f7753aa38f22de2d2abcd1346da1de68ec99e1 = 64003 }` | enumInstrument keys indicating time periods within a frame. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8257d777dfadfa1751f2ea472aef06ce` | enumThe set of states that the TuningFork_reportLifecycleEvent method accepts. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gaf955e175ba077af90ea7fd66cd8429db` | enum |

| ### Typedefs ||
|---|---|
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga226ceba1a1596ee68717ac2aaedad5ba)(const struct SwappyTracer *)` | typedef `void(*` Pointer to Swappy_injectTracers that can be attached to [TuningFork_Settings::swappy_tracer_fn](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings_1a075dd6f093d9e6f41e07964171e09547). |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga443ae20608603036f7706b67cc620a3f` | typedef `struct https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-array#struct_tuning_fork___c_protobuf_array` A series of bytes representing an array of serialized protocol buffers. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga7323f5236738a4805bfeabbf65ee775a` | typedef `struct https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization` A series of bytes representing a serialized protocol buffer. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8af79bbe29b44209545729546b9193c5` | typedef `uint64_t` A duration in nanoseconds. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga192f7d591707e63c9d17fa3cba0ff4b5` | typedef `enum https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` All the error codes that can be returned by Tuning Fork functions. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga1a8f1743f180343c029abb264f9ad20b)(const TuningFork_CProtobufSerialization *)` | typedef `void(*` Pointer to a function that can be attached to [TuningFork_Settings::fidelity_params_callback](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings_1a5b60ba7d9bb38b2eefe0332dce919037). |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8d0e7315911561c6f81a1f36d17d218f` | typedef `uint16_t` The instrumentation key identifies a tick point within a frame or a trace segment. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga3c2364a6dbff2d05d38b608f62fb7350` | typedef `enum https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8257d777dfadfa1751f2ea472aef06ce` The set of states that the TuningFork_reportLifecycleEvent method accepts. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gabdda1aa76486c1cd195efff8c0e5bbcd` | typedef `uint64_t` A handle used in TuningFork_startRecordingLoadingTime. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga13f99912771885a739d1d7917bb47686` | typedef `uint64_t` A handle used in TuningFork_startLoadingGroup. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga46b02a6358e397134ade4f8380d86419` | typedef `struct https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata#struct_tuning_fork___loading_time_metadata` Metadata recorded with a loading time event. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga03d57dd42a6825776fce1d1b9b38abff` | typedef `struct https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-metric-limits#struct_tuning_fork___metric_limits` Limits on the number of metrics of each type. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga1dff42cbd248b059c0a1e590bfbbde44` | typedef `struct https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings` Initialization settings Zero any values that are not being used. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gab173773b54e3abeee67c6c9a3ae01b31` | typedef `enum TuningFork_Submission` |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga808c79d13982cc7dc82f64dc1b56570b` | typedef `uint64_t` A time as milliseconds past the epoch. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga4d31b271f08e11d01b38f083d08a45c6` | typedef `uint64_t` A trace handle used in TuningFork_startTrace. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gab751f6f3295d24dd9ffb7992f2d34768)(const char *message, size_t size)` | typedef `void(*` Pointer to a function that can be passed to TuningFork_setUploadCallback. |

| ### Functions ||
|---|---|
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga7e068ea6cfae09fa3f46322c4b8e26c2(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-array#struct_tuning_fork___c_protobuf_array *array)` | `void` Deallocate any memory owned by the given protobuf array. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gae920d8055d8e68786ec8707871d90ad8(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *ser)` | `void` Deallocate any memory owned by the protocol buffer serialization. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga587634d6f2084eee13ee3a766a9d4465()` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Clean up all memory owned by Tuning Fork and kill any threads. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga264b03ab3481cf78264ee32665167873(bool enable)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Enable or disable memory telemetry recording. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga865a274b4c894d1628f6ec67177858de(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga4d31b271f08e11d01b38f083d08a45c6 handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Stop and record a trace segment. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gad555416c3a9786c0fad1ebe4cea3e7ff()` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Force upload of the current histograms. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga563da1c5e6ad4f9f9fa40700ceb9d26d(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8d0e7315911561c6f81a1f36d17d218f key, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8af79bbe29b44209545729546b9193c5 dt)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record a frame tick using an external time, rather than system time. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga323604518acc5ee76d7a9309d752e011(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8d0e7315911561c6f81a1f36d17d218f key)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record a frame tick that will be associated with the instrumentation key and the current annotation. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gae6c8c93e085cba82f0939ce1ff6ea644(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *defaultParams, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *params, uint32_t timeout_ms)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` A blocking call to get fidelity parameters from the server. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga709e1d0f31cea732599d1384ad51bb15(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings *settings, JNIEnv *env, jobject context)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Initialize Tuning Fork. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga458a7e97301579790316805d856f6264()` | `bool` Check if frame time logging is paused. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga125750138aaef1dc1d12ea4d3d936623()` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Pause the recording of frame times to the frame time histogram. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga2945cb3589d188e292cc9858b2519123(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-array#struct_tuning_fork___c_protobuf_array *qualityLevels, uint32_t target_frame_time_ms, uint32_t timeout_ms)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` A blocking call to get quality level predictions from the server. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga813e0d92b49764f6c7cd4993d34a6cde(uint64_t time_ns, const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata#struct_tuning_fork___loading_time_metadata *eventMetadata, uint32_t eventMetadataSize, const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *annotation)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record a loading time event. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga70a7410d4e2a5ceb7d9155ddc385995b(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8257d777dfadfa1751f2ea472aef06ce state)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record the state change of the app's lifecycle. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gaf1cb6300317110e477c24550595a1747()` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Resume the recording of frame times to the frame time histogram. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gaa4e0d529c430e7984094d6f8719ce7fc(TuningFork_Submission method, uint32_t interval_ms_or_count)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Set the interval between histogram uploads, overriding that in settings. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga2a9e6ccbb5b33442b60357958dcdc9dd(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *annotation)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Set the current annotation. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gaf78854b8117acb5377dad0b89736bc09(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *params)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Set the currently active fidelity parameters. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gacefba5b64dc6209e50b7a93cd099b49c(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gab751f6f3295d24dd9ffb7992f2d34768 cbk)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Set a callback to be called on a separate thread every time TuningFork performs an upload. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga41cc0fd9937af738493d1a0625f2306d(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata#struct_tuning_fork___loading_time_metadata *eventMetadata, uint32_t eventMetadataSize, const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *annotation, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga13f99912771885a739d1d7917bb47686 *handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Start a loading group. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gacb98a423f5f10b3dc21c16f7f3f5c6ab(const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata#struct_tuning_fork___loading_time_metadata *eventMetadata, uint32_t eventMetadataSize, const https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization#struct_tuning_fork___c_protobuf_serialization *annotation, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gabdda1aa76486c1cd195efff8c0e5bbcd *handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record the start of a loading event. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga9187b99a912837ae852b490e7aae051b(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga8d0e7315911561c6f81a1f36d17d218f key, https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga4d31b271f08e11d01b38f083d08a45c6 *handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Start a trace segment. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gacc1072b6a70e28e85195030faef8224f(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga13f99912771885a739d1d7917bb47686 handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Stop recording events as belonging to a group and record a group event. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga6d1f574fa4c5944834596e6978637ad9(https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gabdda1aa76486c1cd195efff8c0e5bbcd handle)` | `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga37de0aa93ae4d18dacdf21778a559527` Record the end of a loading event. |
| `https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga6583b422e1c11f6bec9038f13d158a8e()` | `const char *` Get the Tuning Fork API version as a null-terminated ASCII string. |

| ### Structs ||
|---|---|
| [TuningFork_CProtobufArray](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-array) | A series of bytes representing an array of serialized protocol buffers. |
| [TuningFork_CProtobufSerialization](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-c-protobuf-serialization) | A series of bytes representing a serialized protocol buffer. |
| [TuningFork_LoadingTimeMetadata](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata) | Metadata recorded with a loading time event. |
| [TuningFork_MetricLimits](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-metric-limits) | Limits on the number of metrics of each type. |
| [TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings) | Initialization settings Zero any values that are not being used. |

## Enumerations

### LoadingSource

```text
 LoadingSource
```

### LoadingState

```text
 LoadingState
```

### NetworkConnectivity

```text
 NetworkConnectivity
```

### TuningFork_ErrorCode

```scdoc
 TuningFork_ErrorCode
```
All the error codes that can be returned by Tuning Fork functions.

| Properties ||
|---|---|
| `TUNINGFORK_ERROR_ALREADY_INITIALIZED` | TuningFork_init was called more than once. |
| `TUNINGFORK_ERROR_B64_ENCODE_FAILED` | Could not encode a protobuf. |
| `TUNINGFORK_ERROR_BAD_FILE_OPERATION` | General file error. |
| `TUNINGFORK_ERROR_BAD_PARAMETER` | Generic bad parameter. |
| `TUNINGFORK_ERROR_BAD_SETTINGS` | Invalid tuningfork_settings.bin file. |
| `TUNINGFORK_ERROR_COULDNT_SAVE_OR_DELETE_FPS` | Error calling `TuningFork_saveOrDeleteFidelityParamsFile`. |
| `TUNINGFORK_ERROR_DOWNLOAD_THREAD_ALREADY_STARTED` | `TuningFork_startFidelityParamDownloadThread` was called more than once, or called when TuningFork_init has already started download. |
| `TUNINGFORK_ERROR_DUPLICATE_START_LOADING_EVENT` | TuningFork_startRecordingLoadingTime was called with the same parameters twice without a stop function inbetween. |
| `TUNINGFORK_ERROR_FRAME_LOGGING_ALREADY_PAUSED` | Cannot pause frame time logging because it is already paused. |
| `TUNINGFORK_ERROR_FRAME_LOGGING_ALREADY_RUNNING` | Cannot resume frame time logging because it is already running. |
| `TUNINGFORK_ERROR_GENERATE_TUNING_PARAMETERS_ERROR` | An error occurred parsing the response to generateTuningParameters. |
| `TUNINGFORK_ERROR_GENERATE_TUNING_PARAMETERS_RESPONSE_NOT_SUCCESS` | The response from generateTuningParameters was not a success code. |
| `TUNINGFORK_ERROR_INVALID_ANNOTATION` | Invalid parameter to `TuningFork_setCurrentAnnotation`. |
| `TUNINGFORK_ERROR_INVALID_DEFAULT_FIDELITY_PARAMS` | `fpDefaultFileNum` is out of range. |
| `TUNINGFORK_ERROR_INVALID_INSTRUMENT_KEY` | Invalid instrument key passed to a tick function. |
| `TUNINGFORK_ERROR_INVALID_LOADING_HANDLE` | Invalid handle passed to `TuningFork_startRecordingLoadingTime`. |
| `TUNINGFORK_ERROR_INVALID_LOADING_STATE` | The loading state was not set as part of [TuningFork_LoadingTimeMetadata](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-loading-time-metadata#struct_tuning_fork___loading_time_metadata) when calling a loading function. |
| `TUNINGFORK_ERROR_INVALID_TRACE_HANDLE` | Invalid handle passed to `TuningFork_startTrace`. |
| `TUNINGFORK_ERROR_JNI_BAD_ENV` | Jni error - obsolete. |
| `TUNINGFORK_ERROR_JNI_BAD_JVM` | Jni error - obsolete. |
| `TUNINGFORK_ERROR_JNI_BAD_THREAD` | Jni error - obsolete. |
| `TUNINGFORK_ERROR_JNI_BAD_VERSION` | Jni error - obsolete. |
| `TUNINGFORK_ERROR_JNI_EXCEPTION` | Jni error - an exception was thrown. See logcat output. |
| `TUNINGFORK_ERROR_METERED_CONNECTION_DISALLOWED` | An HTTP request could not be made because there is no unmetered connection available. |
| `TUNINGFORK_ERROR_NO_ACTIVE_LOADING_GROUP` | There was no active loading group when TuningFork_stopLoadingGroup was called. |
| `TUNINGFORK_ERROR_NO_CLEARCUT` | Obsolete. |
| `TUNINGFORK_ERROR_NO_FIDELITY_PARAMS` | No fidelity parameters found at initialization. |
| `TUNINGFORK_ERROR_NO_FIDELITY_PARAMS_IN_APK` | No dev_tuningfork_fidelityparams_#.bin found in assets/tuningfork. |
| `TUNINGFORK_ERROR_NO_MORE_SPACE_FOR_FRAME_TIME_DATA` | Not enough space for metric data was allocated at start-up: increase Settings.max_num_metrics.frame_time or check max_num_instrument_keys |
| `TUNINGFORK_ERROR_NO_MORE_SPACE_FOR_LOADING_TIME_DATA` | Not enough space for metric data was allocated at start-up: increase Settings.max_num_metrics.loading_time. |
| `TUNINGFORK_ERROR_NO_SETTINGS` | No tuningfork_settings.bin found in assets/tuningfork. |
| `TUNINGFORK_ERROR_NO_SETTINGS_ANNOTATION_ENUM_SIZES` | Missing part of tuningfork_settings.bin. |
| `TUNINGFORK_ERROR_NO_SUCH_KEY` | No such key when accessing file cache. |
| `TUNINGFORK_ERROR_NO_SWAPPY` | Not able to find the required Swappy functions. |
| `TUNINGFORK_ERROR_OK` | No error. |
| `TUNINGFORK_ERROR_PLATFORM_NOT_SUPPORTED` | Obsolete. |
| `TUNINGFORK_ERROR_PREDICT_QUALITY_LEVELS_PARSE_ERROR` | An error occurred parsing the response to predictQualityLevels. |
| `TUNINGFORK_ERROR_PREDICT_QUALITY_LEVELS_RESPONSE_ERROR` | The response from predictQualityLevels was not a success code. |
| `TUNINGFORK_ERROR_PREVIOUS_UPLOAD_PENDING` | Can't upload since another request is pending. |
| `TUNINGFORK_ERROR_TIMEOUT` | Timeout in request for fidelity parameters. |
| `TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED` | A call was made before Tuning Fork was initialized. |
| `TUNINGFORK_ERROR_UPLOAD_TOO_FREQUENT` | Too frequent calls to `TuningFork_flush`. |

### TuningFork_InstrumentKeys

```scdoc
 TuningFork_InstrumentKeys
```
Instrument keys indicating time periods within a frame.

Keys 64000-65535 are reserved

| Properties ||
|---|---|
| `TFTICK_CPU_TIME` | The time between frame start and the call to Swappy_swap. |
| `TFTICK_GPU_TIME` | The time between buffer swap and GPU fence triggering. |
| `TFTICK_PACED_FRAME_TIME` | Frame time between ends of eglSwapBuffers calls or Vulkan queue present. |
| `TFTICK_RAW_FRAME_TIME` | If GPU time is available, thisis MAX(CPU_TIME,GPU_TIME) If not, this is the same as PACED_FRAME_TIME. |

### TuningFork_LifecycleState

```scdoc
 TuningFork_LifecycleState
```
The set of states that the TuningFork_reportLifecycleEvent method accepts.

### TuningFork_Submission

```scdoc
 TuningFork_Submission
```

## Typedefs

### SwappyTracerFn

```gdscript
void(* SwappyTracerFn)(const struct SwappyTracer *)
```
Pointer to Swappy_injectTracers that can be attached to [TuningFork_Settings::swappy_tracer_fn](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings_1a075dd6f093d9e6f41e07964171e09547).


**See also:**
[TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings)

### TuningFork_CProtobufArray

```scdoc
struct TuningFork_CProtobufArray TuningFork_CProtobufArray
```
A series of bytes representing an array of serialized protocol buffers.

**See also:** [TuningFork_CProtobufArray_free](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga7e068ea6cfae09fa3f46322c4b8e26c2) for how to deallocate the memory once finished with the buffer.

### TuningFork_CProtobufSerialization

```scdoc
struct TuningFork_CProtobufSerialization TuningFork_CProtobufSerialization
```
A series of bytes representing a serialized protocol buffer.

**See also:** [TuningFork_CProtobufSerialization_free](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1gae920d8055d8e68786ec8707871d90ad8) for how to deallocate the memory once finished with the buffer.

### TuningFork_Duration

```scdoc
uint64_t TuningFork_Duration
```
A duration in nanoseconds.

### TuningFork_ErrorCode

```gdscript
enum TuningFork_ErrorCode TuningFork_ErrorCode
```
All the error codes that can be returned by Tuning Fork functions.

### TuningFork_FidelityParamsCallback

```gdscript
void(* TuningFork_FidelityParamsCallback)(const TuningFork_CProtobufSerialization *)
```
Pointer to a function that can be attached to [TuningFork_Settings::fidelity_params_callback](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings_1a5b60ba7d9bb38b2eefe0332dce919037).

Function that will be called with the fidelity parameters that are downloaded. **See also:** [TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings)
Fidelity parameters are serializations of FidelityParams messages defined in a game's dev_tuningfork.proto file. The structure of this message is completely up to the developer, with limitations outlined in the integration guide.

### TuningFork_InstrumentKey

```scdoc
uint16_t TuningFork_InstrumentKey
```
The instrumentation key identifies a tick point within a frame or a trace segment.

### TuningFork_LifecycleState

```gdscript
enum TuningFork_LifecycleState TuningFork_LifecycleState
```
The set of states that the TuningFork_reportLifecycleEvent method accepts.

### TuningFork_LoadingEventHandle

```scdoc
uint64_t TuningFork_LoadingEventHandle
```
A handle used in TuningFork_startRecordingLoadingTime.

### TuningFork_LoadingGroupHandle

```scdoc
uint64_t TuningFork_LoadingGroupHandle
```
A handle used in TuningFork_startLoadingGroup.

### TuningFork_LoadingTimeMetadata

```scdoc
struct TuningFork_LoadingTimeMetadata TuningFork_LoadingTimeMetadata
```
Metadata recorded with a loading time event.

### TuningFork_MetricLimits

```scdoc
struct TuningFork_MetricLimits TuningFork_MetricLimits
```
Limits on the number of metrics of each type.

Zero any values to get the default for that type:

Frame time: min(64, the maximum number of annotation combinations) \* num_instrument_keys.

Loading time: 32.

Battery: 32.

Thermal: 32.

Memory: 15 possible memory metrics.

### TuningFork_Settings

```scdoc
struct TuningFork_Settings TuningFork_Settings
```
Initialization settings Zero any values that are not being used.

### TuningFork_Submission

```gdscript
enum TuningFork_Submission TuningFork_Submission
```

### TuningFork_TimePoint

```scdoc
uint64_t TuningFork_TimePoint
```
A time as milliseconds past the epoch.

### TuningFork_TraceHandle

```scdoc
uint64_t TuningFork_TraceHandle
```
A trace handle used in TuningFork_startTrace.

### TuningFork_UploadCallback

```gdscript
void(* TuningFork_UploadCallback)(const char *message, size_t size)
```
Pointer to a function that can be passed to TuningFork_setUploadCallback.


Function that will be called on a separate thread every time TuningFork performs an upload. **See also:** [TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings)

| Details ||
|---|---|
| Parameters | |---|---| | `message` | UTF-8 string containing the JSON uploaded. | | `size` | Number of bytes in message. | |

## Functions

### TuningFork_CProtobufArray_free

```scdoc
void TuningFork_CProtobufArray_free(
  TuningFork_CProtobufArray *array
)
```
Deallocate any memory owned by the given protobuf array.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `array` | A protocol buffer array | |

### TuningFork_CProtobufSerialization_free

```scdoc
void TuningFork_CProtobufSerialization_free(
  TuningFork_CProtobufSerialization *ser
)
```
Deallocate any memory owned by the protocol buffer serialization.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `ser` | A protocol buffer serialization | |

### TuningFork_destroy

```scdoc
TuningFork_ErrorCode TuningFork_destroy()
```
Clean up all memory owned by Tuning Fork and kill any threads.

<br />

| Details ||
|---|---|
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_enableMemoryRecording

```scdoc
TuningFork_ErrorCode TuningFork_enableMemoryRecording(
  bool enable
)
```
Enable or disable memory telemetry recording.

By default, memory telemetry recording is turned on at initialization, however currently the memory statistics are not shown in the Play UI.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `enable` | If true, memory recording is enabled, if false it is disabled. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_endTrace

```scdoc
TuningFork_ErrorCode TuningFork_endTrace(
  TuningFork_TraceHandle handle
)
```
Stop and record a trace segment.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `handle` | this is a handle previously returned by TuningFork_startTrace | |
| **Returns** | TUNINGFORK_ERROR_INVALID_TRACE_HANDLE if the handle is invalid. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_flush

```scdoc
TuningFork_ErrorCode TuningFork_flush()
```
Force upload of the current histograms.

<br />

| Details ||
|---|---|
| **Returns** | TUNINGFORK_ERROR_OK if the upload could be initiated. |
| **Returns** | TUNINGFORK_ERROR_PREVIOUS_UPLOAD_PENDING if there is a previous upload blocking this one. |
| **Returns** | TUNINGFORK_ERROR_UPLOAD_TOO_FREQUENT if less than a minute has elapsed since the previous upload. |

### TuningFork_frameDeltaTimeNanos

```scdoc
TuningFork_ErrorCode TuningFork_frameDeltaTimeNanos(
  TuningFork_InstrumentKey key,
  TuningFork_Duration dt
)
```
Record a frame tick using an external time, rather than system time.

**See also:**the reserved instrument keys above

| Details ||
|---|---|
| Parameters | |---|---| | `key` | an instrument key | |
| Parameters | |---|---| | `dt` | the duration you wish to record (in nanoseconds) | |
| **Returns** | TUNINGFORK_ERROR_INVALID_INSTRUMENT_KEY if the instrument key is invalid. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_frameTick

```scdoc
TuningFork_ErrorCode TuningFork_frameTick(
  TuningFork_InstrumentKey key
)
```
Record a frame tick that will be associated with the instrumentation key and the current annotation.

NB: calling the tick or trace functions from different threads is allowed, but a single instrument key should always be ticked from the same thread. **See also:**the reserved instrument keys above

| Details ||
|---|---|
| Parameters | |---|---| | `key` | an instrument key | |
| **Returns** | TUNINGFORK_ERROR_INVALID_INSTRUMENT_KEY if the instrument key is invalid. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_getFidelityParameters

```gdscript
TuningFork_ErrorCode TuningFork_getFidelityParameters(
  const TuningFork_CProtobufSerialization *defaultParams,
  TuningFork_CProtobufSerialization *params,
  uint32_t timeout_ms
)
```
A blocking call to get fidelity parameters from the server.

You do not need to call this if you pass in a fidelity_params_callback as part of the settings to TuningFork_init. Note that once fidelity parameters are downloaded, any timing information is recorded as being associated with those parameters. If you subsequently call GetFidelityParameters and a new set of parameters is downloaded, any data that is already collected will be submitted to the backend. Ownership of 'params' is transferred to the caller, so they must call params-\>dealloc when they are done with it. The parameter request is sent to: ${url_base}+'applications/'+package_name+'/apks/'+version_number+':generateTuningParameters'.

| Details ||
|---|---|
| Parameters | |---|---| | `defaultParams` | these will be assumed current if no parameters could be downloaded. | | `params` |   | | `timeout_ms` | time to wait before returning from this call when no connection can be made. If zero or negative, the value in Settings.initial_request_timeout_ms is used. | |
| **Returns** | TUNINGFORK_ERROR_TIMEOUT if there was a timeout before params could be downloaded. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if TuningFork_init has not been called. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_init

```gdscript
TuningFork_ErrorCode TuningFork_init(
  const TuningFork_Settings *settings,
  JNIEnv *env,
  jobject context
)
```
Initialize Tuning Fork.

This must be called before any other functions.

The library will load histogram and annotation settings from your tuningfork_settings.bin file. **See also:** [TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings) for the semantics of how other settings change initialization behaviour.

| Details ||
|---|---|
| Parameters | |---|---| | `settings` | a [TuningFork_Settings](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/struct/tuning-fork-settings#struct_tuning_fork___settings) structure | | `env` | a JNIEnv | | `context` | the app context | |
| **Returns** | TUNINGFORK_ERROR_OK if successful, |
| **Returns** | TUNINGFORK_ERROR_NO_SETTINGS if no settings could be found, |
| **Returns** | TUNINGFORK_ERROR_BAD_SETTINGS if your tuningfork_settings.bin file was invalid or |
| **Returns** | TUNINGFORK_ERROR_ALREADY_INITIALIZED if tuningfork was already initialized. |

### TuningFork_isFrameTimeLoggingPaused

```scdoc
bool TuningFork_isFrameTimeLoggingPaused()
```
Check if frame time logging is paused.

<br />

| Details ||
|---|---|
| **Returns** | true if frame time logging is paused. False otherwise. |

### TuningFork_pauseFrameTimeLogging

```scdoc
TuningFork_ErrorCode TuningFork_pauseFrameTimeLogging()
```
Pause the recording of frame times to the frame time histogram.

This can be useful for disabling frame time recording during menus or loading.

<br />

| Details ||
|---|---|
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_FRAME_LOGGING_ALREADY_PAUSED if logging is already paused |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_predictQualityLevels

```scdoc
TuningFork_ErrorCode TuningFork_predictQualityLevels(
  TuningFork_CProtobufArray *qualityLevels,
  uint32_t target_frame_time_ms,
  uint32_t timeout_ms
)
```
A blocking call to get quality level predictions from the server.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `qualityLevels` | quality levels returned as an array for serialized protocol buffers. Can be empty if quality levels for the apk are not defined. | | `target_frame_time_ms` | the desired time per frame, in milliseconds | | `timeout_ms` | time to wait before returning from this call when no connection can be made. If zero, the value in Settings.initial_request_timeout_ms is used. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TIMEOUT if there was a timeout before predictions could be returned. |
| **Returns** | TUNINGFORK_ERROR_PREDICT_QUALITY_LEVELS_RESPONSE_ERROR if the call to the server failed. |
| **Returns** | TUNINGFORK_ERROR_PREDICT_QUALITY_LEVELS_PARSE_ERROR if the response couldn't be parsed. |

### TuningFork_recordLoadingTime

```gdscript
TuningFork_ErrorCode TuningFork_recordLoadingTime(
  uint64_t time_ns,
  const TuningFork_LoadingTimeMetadata *eventMetadata,
  uint32_t eventMetadataSize,
  const TuningFork_CProtobufSerialization *annotation
)
```
Record a loading time event.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `time_ns` | The time taken for loading event in nanoseconds | | `eventMetadata` | A LoadingTimeMetadata structure | | `eventMetadataSize` | Size in bytes of the LoadingTimeMetadata structure | | `annotation` | The annotation to use with this event. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_INVALID_LOADING_STATE if state was not set in the metadata. |

### TuningFork_reportLifecycleEvent

```scdoc
TuningFork_ErrorCode TuningFork_reportLifecycleEvent(
  TuningFork_LifecycleState state
)
```
Record the state change of the app's lifecycle.

This method should be called every time the onCreate(), onStart(), onStop() and onDestroy() methods are triggered for the app. This will help tuning fork keep track of exactly when the app is on foreground or background.

| Details ||
|---|---|
| Parameters | |---|---| | `state` | The new lifecycle state of the app | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_resumeFrameTimeLogging

```scdoc
TuningFork_ErrorCode TuningFork_resumeFrameTimeLogging()
```
Resume the recording of frame times to the frame time histogram.

<br />

| Details ||
|---|---|
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_FRAME_LOGGING_ALREADY_RUNNING if logging isn't paused |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_setAggregationStrategyInterval

```verilog
TuningFork_ErrorCode TuningFork_setAggregationStrategyInterval(
  TuningFork_Submission method,
  uint32_t interval_ms_or_count
)
```
Set the interval between histogram uploads, overriding that in settings.


**See also:**
[TuningFork_frameTick](https://developer.android.com/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#group__tuningfork_1ga323604518acc5ee76d7a9309d752e011)

| Details ||
|---|---|
| Parameters | |---|---| | `method` | Whether to use time-based or tick-based strategy. | | `interval_ms_or_count` | Millisecond or count-based interval. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |
| **Returns** | TUNINGFORK_ERROR_BAD_PARAMETER if method is not TIME_BASED or TICK_BASED or if interval_ms_or_count is 0 or greater than one day. |

### TuningFork_setCurrentAnnotation

```gdscript
TuningFork_ErrorCode TuningFork_setCurrentAnnotation(
  const TuningFork_CProtobufSerialization *annotation
)
```
Set the current annotation.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `annotation` | the protobuf serialization of the current annotation. | |
| **Returns** | TUNINGFORK_ERROR_INVALID_ANNOTATION if annotation is inconsistent with the settings. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_setFidelityParameters

```gdscript
TuningFork_ErrorCode TuningFork_setFidelityParameters(
  const TuningFork_CProtobufSerialization *params
)
```
Set the currently active fidelity parameters.

This function overrides any parameters that have been downloaded if in experiment mode. Use when, for instance, the player has manually changed game quality settings. This flushes (i.e. uploads) any data associated with any previous parameters.

| Details ||
|---|---|
| Parameters | |---|---| | `params` | The protocol buffer encoded parameters. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_setUploadCallback

```gdscript
TuningFork_ErrorCode TuningFork_setUploadCallback(
  TuningFork_UploadCallback cbk
)
```
Set a callback to be called on a separate thread every time TuningFork performs an upload.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `cbk` |   | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_TUNINGFORK_NOT_INITIALIZED if Tuning Fork wasn't initialized. |

### TuningFork_startLoadingGroup

```gdscript
TuningFork_ErrorCode TuningFork_startLoadingGroup(
  const TuningFork_LoadingTimeMetadata *eventMetadata,
  uint32_t eventMetadataSize,
  const TuningFork_CProtobufSerialization *annotation,
  TuningFork_LoadingGroupHandle *handle
)
```
Start a loading group.

Subsequent loading times will be tagged with this group's id until startLoadingGroup is called again or stopLoadingGroup is called.

| Details ||
|---|---|
| Parameters | |---|---| | `eventMetadata` | A LoadingTimeMetadata structure. | | `eventMetadataSize` | Size in bytes of the LoadingTimeMetadata structure (for versioning of the structure). | | `annotation` | The annotation to use with this event. | | `handle` | A handle for this event (currently is always null since there can only be one loading group active). | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_INVALID_LOADING_STATE if state was not set in the metadata. |

### TuningFork_startRecordingLoadingTime

```gdscript
TuningFork_ErrorCode TuningFork_startRecordingLoadingTime(
  const TuningFork_LoadingTimeMetadata *eventMetadata,
  uint32_t eventMetadataSize,
  const TuningFork_CProtobufSerialization *annotation,
  TuningFork_LoadingEventHandle *handle
)
```
Record the start of a loading event.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `eventMetadata` | A LoadingTimeMetadata structure. | | `eventMetadataSize` | Size in bytes of the LoadingTimeMetadata structure (for versioning of the structure). | | `annotation` | The annotation to use with this event. | | `handle` | A handle for this event. | |
| **Returns** | TUNINGFORK_ERROR_OK on success. |
| **Returns** | TUNINGFORK_ERROR_INVALID_LOADING_STATE if state was not set in the metadata. |

### TuningFork_startTrace

```scdoc
TuningFork_ErrorCode TuningFork_startTrace(
  TuningFork_InstrumentKey key,
  TuningFork_TraceHandle *handle
)
```
Start a trace segment.

**See also:**the reserved instrument keys above

| Details ||
|---|---|
| Parameters | |---|---| | `key` | an instrument key | |
| Parameters | |---|---| | `handle` | this is filled with a new handle on success. | |
| **Returns** | TUNINGFORK_ERROR_INVALID_INSTRUMENT_KEY if the instrument key is invalid. |
| **Returns** | TUNINGFORK_ERROR_OK on success. |

### TuningFork_stopLoadingGroup

```scdoc
TuningFork_ErrorCode TuningFork_stopLoadingGroup(
  TuningFork_LoadingGroupHandle handle
)
```
Stop recording events as belonging to a group and record a group event.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `handle` | A handle generated by startLoadingGroup (currently should be 0). | |

### TuningFork_stopRecordingLoadingTime

```scdoc
TuningFork_ErrorCode TuningFork_stopRecordingLoadingTime(
  TuningFork_LoadingEventHandle handle
)
```
Record the end of a loading event.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `handle` | A handle generated by startRecordingLoadingTime | |

### Tuningfork_versionString

```gdscript
const char * Tuningfork_versionString()
```
Get the Tuning Fork API version as a null-terminated ASCII string.