获取CPU使用率分为系统的CPU使用率、进程的CPU使用率和线程的CPU使用率三种情况。
let systemCpuUsage = hidebug.getSystemCpuUsage(); // 获取系统的CPU资源占用情况
let cpuUsage: number = hidebug.getCpuUsage(); // 获取进程的CPU使用率
let appThreadCpuUsage: hidebug.ThreadCpuUsage[] = hidebug.getAppThreadCpuUsage(); // 获取应用线程CPU使用情况 let threadCpuUsage = ''; for (let i = 0; i < appThreadCpuUsage.length; i++) { threadCpuUsage = threadCpuUsage + `threadId=${appThreadCpuUsage[i].threadId}, cpuUsage=${appThreadCpuUsage[i].cpuUsage}` + '\n'; }