更新记录
3.0.0(2026-08-17)
第一版更新 显示cpu、内存、温度使用情况可以更方便的监控软件性能
平台兼容性
uni-app(4.71)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| √ | √ | × | × | √ | √ | √ | √ | × |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | × | × | × | × | × | × |
其他
| 多语言 | 暗黑模式 | 宽屏模式 |
|---|---|---|
| × | √ | √ |
asrmall-monitor
Android、iOS 应用内性能调试悬浮层。插件只在调用后采样,不申请系统悬浮窗权限,不显示到其他应用上。
使用
// #ifdef APP
import {
showPerformanceMonitor,
updatePerformanceMonitor,
hidePerformanceMonitor,
getPerformanceSnapshotSync
} from '@/uni_modules/asrmall-monitor'
showPerformanceMonitor({
top: 52,
left: 8,
updateInterval: 1000,
opacity: 0.65,
textSize: 12
})
// 切换到右上角。尺寸和偏移单位为 px。
updatePerformanceMonitor({ top: 52, right: 8 })
console.log(getPerformanceSnapshotSync())
// 停止采样并移除悬浮层。
hidePerformanceMonitor()
// #endif
可传配置:top、right、bottom、left、updateInterval、opacity、textSize。不同次更新时新传入的一侧覆盖旧侧;同一次同时传两侧时,right、bottom 优先。
指标说明
- CPU:当前应用进程 CPU 使用率,按设备逻辑处理器数量归一化为
0-100%。 - 内存:Android 为当前进程 PSS,iOS 为当前进程
phys_footprint,单位 MB。 - FPS:主线程显示回调在采样窗口内的实际触发频率,主线程卡顿时会下降。
- 温度:Android 显示系统提供的电池温度;iOS 无公开数值温度 API,显示
0。 - GPU:Android、iOS 均无稳定公开的单应用 GPU 占用率 API,显示
0。
getPerformanceSnapshotSync() 额外返回 gpuSupported、temperatureSupported 和 thermalState,用于区分“不支持”和真实零值。thermalState 两端统一为 0 正常、1 轻度、2 严重、3 危急。
注意
该插件用于开发调试。发布前应移除 showPerformanceMonitor 调用,避免采样本身带来少量 CPU 和内存开销。

收藏人数:
购买源码授权版(
试用
赞赏(0)
下载 0
赞赏 0
下载 12514208
赞赏 1943
赞赏
京公网安备:11010802035340号