From 2b13bb694532904704c16bec4e8a47c386e681e2 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 30 Jul 2021 01:15:11 +0530 Subject: feat(runtime): implement navigator.hardwareConcurrency (#11448) This commit implements "navigator.hardwareConcurrency" API, which supersedes "Deno.systemCpuInfo()" API (which was removed in this commit). --- runtime/ops/os.rs | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'runtime/ops') diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs index 80e4995e6..c9567a7d7 100644 --- a/runtime/ops/os.rs +++ b/runtime/ops/os.rs @@ -25,7 +25,6 @@ pub fn init() -> Extension { ("op_loadavg", op_sync(op_loadavg)), ("op_os_release", op_sync(op_os_release)), ("op_system_memory_info", op_sync(op_system_memory_info)), - ("op_system_cpu_info", op_sync(op_system_cpu_info)), ]) .build() } @@ -180,23 +179,3 @@ fn op_system_memory_info( Err(_) => Ok(None), } } - -#[derive(Serialize)] -struct CpuInfo { - cores: Option, - speed: Option, -} - -fn op_system_cpu_info( - state: &mut OpState, - _args: (), - _: (), -) -> Result { - super::check_unstable(state, "Deno.systemCpuInfo"); - state.borrow_mut::().env.check_all()?; - - let cores = sys_info::cpu_num().ok(); - let speed = sys_info::cpu_speed().ok(); - - Ok(CpuInfo { cores, speed }) -} -- cgit v1.2.3