การใช้งานขั้นสูง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ส่วนต่อไปนี้จะอธิบายหัวข้อการใช้งานขั้นสูงที่ไม่จำเป็นสำหรับการทำงานปกติของไลบรารี
เครื่องมือติดตามอื่นๆ ที่รองรับ
Tuning Fork รองรับเครื่องมือติดตามหลายรายการ ระบบรองรับเครื่องมือติดตามที่มีคีย์เครื่องมือต่อไปนี้
- เวลาระหว่างการเริ่มต้นเฟรม (เรียกว่า
PACED_FRAME_TIME
)
- เวลา CPU: เวลาตั้งแต่เริ่มต้นเฟรมจนถึงสิ้นสุดการทำงานของ CPU
สำหรับเฟรม (เรียกว่า
CPU_TIME
)
- เวลา GPU: เวลาที่ GPU ใช้จัดการเฟรมก่อนหน้า (เรียกว่า
GPU_TIME
)
- เวลาเฟรมดิบ ซึ่งกำหนดเป็นเวลาสูงสุดของเวลา CPU และ GPU (เรียกว่า
RAW_FRAME_TIME
) ตัวเลือกนี้แตกต่างจาก PACED_FRAME_TIME
ตรงที่ตัวเลือกนี้ไม่รวมเวลารอที่ Swappy หรือ
VSync รวมไว้
คุณดูคีย์เครื่องดนตรีเหล่านี้ได้ในเอกสารอ้างอิง
ระบบจะใช้คีย์บางรายการเหล่านี้โดยอัตโนมัติเมื่อคุณเปิดใช้ไลบรารี Android Frame
Pacing แต่หากไม่ได้เปิดใช้ไลบรารีนี้ คุณควรใช้คีย์เหล่านี้อย่างชัดแจ้ง
รับพารามิเตอร์ความแม่นยำ
TFErrorCode TuningFork_getFidelityParameters(const CProtobufSerialization*
defaultParams, CProtobufSerialization* params, uint32_t
timeout_ms);
หากส่ง fidelity_params_callback
ไปยัง TuningFork_init
ในการตั้งค่าหรือ
ไลบรารีอยู่ในโหมดที่ปรับขนาดแล้ว คุณไม่จำเป็นต้องเรียกใช้ฟังก์ชันนี้
ฟังก์ชันนี้จะติดต่อเซิร์ฟเวอร์เพื่อดึงพารามิเตอร์ความเที่ยงตรง โดยจะบล็อกจนกว่า
จะมีสิ่งต่อไปนี้เกิดขึ้น
- ระบบจะเรียกพารามิเตอร์ความแม่นยำโดยมีค่าที่ส่งคืนเป็น
TFERROR_OK
และ
returnedParams
จะจัดเก็บพารามิเตอร์ ในกรณีนี้ ข้อมูลเครื่องหมาย
ทั้งหมดที่ตามมาจะเชื่อมโยงกับ returnedParams
- เมื่อผ่านไปเป็นจำนวนมิลลิวินาทีเท่ากับ
timeout_ms
ระบบจะแสดงค่า TFERROR_TIMEOUT
ในกรณีนี้ ข้อมูลเครื่องหมายทั้งหมดในภายหลังจะเชื่อมโยงกับ defaultFidelityParams
คุณต้องเรียกใช้ TuningFork_init()
ก่อนฟังก์ชันนี้ และต้องเรียกใช้ใน
เทรดแยกต่างหากจากเทรดหลัก (ดู
TuningFork_startFidelityParamDownloadThread()
เพื่อดูฟังก์ชันยูทิลิตีที่ทำสิ่งนี้ให้คุณ) คุณเรียกใช้ฟังก์ชันนี้อีกครั้งได้ เช่น ในเวลาที่โหลดเลเวล เพื่อดึงพารามิเตอร์ความเที่ยงตรงจากเซิร์ฟเวอร์อีกครั้ง ซึ่งช่วยให้คุณอัปเดตพารามิเตอร์แบบไดนามิกได้แทนที่จะต้องโหลดซ้ำเฉพาะตอนเริ่มต้น หากมีการดาวน์โหลดพารามิเตอร์ความเที่ยงตรงใหม่
หรือใช้ค่าเริ่มต้นใหม่ ระบบจะส่งข้อมูลราคาแบบเรียลไทม์ก่อนหน้าทั้งหมด
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-26 UTC
[null,null,["อัปเดตล่าสุด 2025-08-26 UTC"],[],[],null,["The following sections outline advanced usage topics not needed for normal\noperation of the library.\n\nOther supported tracers\n\nTuning Fork supports multiple tracers. Tracers with the following instrument\nkeys are supported:\n\n- Time between frame starts (called `PACED_FRAME_TIME`)\n- CPU Time: Time between the start of the frame and the end of the CPU work for the frame (called `CPU_TIME`)\n- GPU Time: Time for the previous frame to be handled by the GPU (called `GPU_TIME`)\n- 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.\n\nYou can find these instrument keys in the\n[reference documentation](/games/sdk/reference/performance-tuner/custom-engine).\nSome of these keys are used automatically when you enable the Android Frame\nPacing library, but if you are not enabling this library, you should use them\nexplicitly.\n\nGet fidelity parameters\n\n[`TFErrorCode TuningFork_getFidelityParameters(const CProtobufSerialization*\ndefaultParams, CProtobufSerialization* params, uint32_t\ntimeout_ms);`](/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork#tuningfork_getfidelityparameters)\n\nIf you pass `fidelity_params_callback` to `TuningFork_init` in settings or the\nlibrary is in scaled mode, you do not need to call this function.\n\nThis function contacts a server to retrieve fidelity parameters. It blocks until\none of the following occurs:\n\n- 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`.\n- 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`.\n\nYou must call `TuningFork_init()` before this function, and you must call it on\na separate thread from the main thread (see\n[`TuningFork_startFidelityParamDownloadThread()`](/games/sdk/reference/performance-tuner/custom-engine/group/tuningfork-extra#tuningfork_startfidelityparamdownloadthread)\nfor a utility function that does this for you). You can call this function\nagain, for example at level-loading time, to retrieve fidelity parameters from\nthe server again. This allows you to dynamically update parameters rather than\nhaving to reload them only at start-up. If new fidelity parameters are\ndownloaded or a new default is used, all previous tick data is submitted."]]