鸿蒙开发之进程相关


function processInfo() {

  //进程是否被隔离
  let isIsolated = process.isIsolatedProcess()
  console.log('process is isIsoladte ' + isIsolated)

  //是否是64位
  let is64 = process.is64Bit()
  console.log('process is 64 ? '+is64)

  //进程启动经过的时间(毫秒)
  let time = process.getStartRealtime()
  console.log('process start time '+time)

  //进程立即退出(abort用于异常终止进程)
  // process.abort()

  //系统已经运行的秒数
  let upTime = process.uptime()
  console.log('process uptime is '+upTime)

  //进程uid
  let processManager = new process.ProcessManager()
  let uid = processManager.getUidForName('MyApplication')
  console.log('process uid is '+uid)

  //获取线程优先级
  let tid = process.tid
  let threadPri = processManager.getThreadPriority(tid)
  console.log('process threadPri is '+threadPri)

  let sysConfig = processManager.getSystemConfig(0)
  console.log('process sysConfig is '+sysConfig)

  //终止程序(exit用于正常终止进程)
  // processManager.exit(0)

  //结束指定的进程
  let pres = process.pid;
  let killRet = processManager.kill(28, pres);//第一个参数指发送的信号
  console.log('process killRet is '+killRet)
}

你可能感兴趣的:(鸿蒙开发,鸿蒙)