diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-07-30 01:15:11 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 21:45:11 +0200 |
commit | 2b13bb694532904704c16bec4e8a47c386e681e2 (patch) | |
tree | 0021131ce86873a5aa965d79b99185b3ca5c5aff /runtime/ops/os.rs | |
parent | eece46f0d85faa90c97841a4f409be39272e809b (diff) |
feat(runtime): implement navigator.hardwareConcurrency (#11448)
This commit implements "navigator.hardwareConcurrency" API, which
supersedes "Deno.systemCpuInfo()" API (which was removed in this commit).
Diffstat (limited to 'runtime/ops/os.rs')
-rw-r--r-- | runtime/ops/os.rs | 21 |
1 files changed, 0 insertions, 21 deletions
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<u32>, - speed: Option<u64>, -} - -fn op_system_cpu_info( - state: &mut OpState, - _args: (), - _: (), -) -> Result<CpuInfo, AnyError> { - super::check_unstable(state, "Deno.systemCpuInfo"); - state.borrow_mut::<Permissions>().env.check_all()?; - - let cores = sys_info::cpu_num().ok(); - let speed = sys_info::cpu_speed().ok(); - - Ok(CpuInfo { cores, speed }) -} |