tencent cloud

Tencent Cloud Super App as a Service

Others

Download
Focus Mode
Font Size
Last updated: 2026-08-14 11:39:37

Integration guide for mini game performance data API

This document is intended for superapp developers integrating the MiniApp SDK. It explains how to proactively fetch performance monitoring data (such as startup time, frame rate, CPU, memory, stuttering, and download traffic) of running mini games to build your own performance monitoring system.

1. Feature description

The SDK provides this capability starting from version 2.4.2 Core features include:
Proactive fetching: The superapp controls the calling timing and frequency. It synchronously returns a snapshot of performance data without the need to register callbacks.
Comprehensive metrics: Covers startup time, frame rate/frame time, CPU, memory, stuttering count, running duration, and download data.
Stuttering detection: Features built-in frame-by-frame detection to count the occurrences of stutters (Jank) and severe stutters (BigJank).
Low intrusiveness: Automatically starts data collection after the first frame is rendered. Incurs no additional overhead if the superapp does not call the API.

2. Usage instructions

#import <TCMPPSDK/TCMPPSDK.h>

// Poll periodically (e.g., once per second) after the mini game starts successfully (handleStartUpSuccessWithApp:)
TMFMiniGamePerfData *data =
[[TMFMiniAppSDKManager sharedInstance] miniGamePerfDataForAppID:appID];
if (data) {
// Parse the fields. See the field descriptions below.
}
The API returns nil in the following scenarios: the appid is empty, the mini game is not running, the appid belongs to a mini program (not a mini game), or the container is not ready before the first frame is rendered. Ensure you perform a null check before accessing the values.

3. Field descriptions

3.1. Basic information

Field
Description
appid
Unique identifier of the mini game.
version
Mini game version.
sdkVersion
SDK version.
baseLibVersion
Base library version.

3.2 Startup time (ms)

Field
Description
requesttime
Network time spent fetching mini game configuration information.
loadtime
Time from tapping to logic layer readiness (including base library loading and code injection).
readytime
Time from tapping to first screen rendering readiness (appearance of the first frame).
Note:
Boundary condition: If the starting point is not recorded (e.g., in some warm start paths), all three fields return 0.

3.3 Runtime performance

Field
Unit
Description
fpsAvg
Frames/sec
Average frame rate.
fpsVariance
-
Frame rate stability. A larger variance indicates greater instability.
frameTime
ms
Average rendering time per frame.
jank
Count
Stuttering count (single frame ≥ 50 ms, approx. < 20 FPS).
bigJank
Count
Severe stuttering count (single frame ≥ 100 ms, approx. < 10 FPS). This is also counted in jank.
cpuAvg / cpuPeak
%
Average/Peak CPU usage of the process (may exceed 100%).
memoryAvg / memoryPeak
MB
Average/Peak memory (absolute physical memory).
memoryGrowth
MB
Memory increment (peak value minus the baseline before startup).
duration
ms
Running duration.
fpsSampleTime
ms
The timestamp (epoch in milliseconds) when the frame rate data was collected. Meaningful only in JIT mode; always 0 in non-JIT mode.

3.4 Download data

Field
Unit
Description
flow
Bytes
Cumulative download traffic.
downtime
ms
Cumulative download time.
modulename
-
Name of the main package or subpackage from the most recent download.

4. Notes

1. Stuttering definition: A single frame rendering time ≥ 50 ms is recorded as jank, and ≥ 100 ms is recorded as bigJank (the latter is also counted in jank).
2. JIT rendering mode: Mini games have two rendering modes: non-JIT and JIT (WKWebView + independent GPU process). In JIT mode, the native side cannot directly collect the frame rate. Instead, the JS side of the base library samples and returns the data. Each fetch retrieves the previous sampled value (lagging by one cycle). You can use fpsSampleTime to determine data freshness. If the base library does not support data return, fpsAvg / frameTime / jank / bigJank / fpsVariance will be 0 in JIT mode, while CPU, memory, startup time, and download data remain unaffected.
3. Cumulative snapshot: The data returned is a cumulative statistic (average, peak, or count) since the first frame was rendered. Fetching the data does not clear it.
4. Calling frequency: The API returns synchronously with extremely low overhead. You can poll it as needed (e.g., once per second as shown in the demo).



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback