Skip to main content
Version: v3+

getPerformance

Start from API_LEVEL 4.0 . Please refer to API_LEVEL.

Get Mini Program performance statistics, including memory usage and loading performance metrics.

Type

function getPerformance(...args: Array<'memory' | 'perf'>): Result

Parameters

Result

PropertyTypeDescriptionAPI_LEVEL
memoryMemoryMemory statistics4.0
perfPerfPerformance statistics4.0

Memory

PropertyTypeDescriptionAPI_LEVEL
systemSystemMemorysystem memory information4.0
appArray<AppMemory>Application memory information list4.0
leakingArray<LeakingMemory>Unreleased memory information list4.0

SystemMemory

PropertyTypeDescriptionAPI_LEVEL
usednumberUsed memory (bytes)4.0
totalnumberTotal memory (bytes)4.0

AppMemory

PropertyTypeDescriptionAPI_LEVEL
appidnumberMini Program ID4.0
usednumberMemory usage (bytes)4.0
peaknumberPeak memory usage (bytes)4.0
modulesArray<MemoryModule>Module memory information4.0

LeakingMemory

PropertyTypeDescriptionAPI_LEVEL
appidnumberMini Program ID4.0
usednumberMemory usage (bytes)4.0
modulesArray<MemoryModule>Module memory information4.0

MemoryModule

PropertyTypeDescriptionAPI_LEVEL
filestringFile path4.0
usednumberMemory usage (bytes)4.0
peaknumberPeak memory usage (bytes)4.0

Perf

PropertyTypeDescriptionAPI_LEVEL
appidnumberMini Program ID4.0
modulesArray<PerfModule>Module performance information list4.0

PerfModule

PropertyTypeDescriptionAPI_LEVEL
filestringFile name4.0
evalTimenumberFile reading and running time (excluding lifecycle execution time)4.0
createTimenumberonCreate lifecycle execution time4.0
initTimenumberonInit lifecycle execution time4.0
buildTimenumberbuild lifecycle execution time4.0

Example

import { getPerformance } from '@zos/app'

// Get memory info only
const memoryProfile = getPerformance('memory')

// Get both memory and performance info
const fullProfile = getPerformance('memory', 'perf')