node_sys/interface/
cpu_info.rs

1use js_sys::{JsString, Object};
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5extern {
6    #[wasm_bindgen(extends = Object)]
7    #[derive(Clone, Debug)]
8    pub type CpuInfo;
9
10    #[wasm_bindgen(method, getter)]
11    pub fn model(this: &CpuInfo) -> JsString;
12
13    #[wasm_bindgen(method, getter)]
14    pub fn speed(this: &CpuInfo) -> f64;
15
16    #[wasm_bindgen(method, getter)]
17    pub fn times(this: &CpuInfo) -> CpuInfoTimes;
18}
19
20#[wasm_bindgen]
21extern {
22    #[wasm_bindgen(extends = Object)]
23    #[derive(Clone, Debug)]
24    pub type CpuInfoTimes;
25
26    #[wasm_bindgen(method, getter)]
27    pub fn idle(this: &CpuInfoTimes) -> f64;
28
29    #[wasm_bindgen(method, getter)]
30    pub fn irq(this: &CpuInfoTimes) -> f64;
31
32    #[wasm_bindgen(method, getter)]
33    pub fn nice(this: &CpuInfoTimes) -> f64;
34
35    #[wasm_bindgen(method, getter)]
36    pub fn sys(this: &CpuInfoTimes) -> f64;
37
38    #[wasm_bindgen(method, getter)]
39    pub fn user(this: &CpuInfoTimes) -> f64;
40}