nv-linux-cpu-usage
v1.0.3
Published
nv-linux-cpu-usage ======================= - simple cpu usage monitor of current-process - this should be used in a worker thread, it will creat 6 setInterval(1s,5s,10s,20s,30s,60s), use it in main process is NOT good
Downloads
3
Readme
nv-linux-cpu-usage
- simple cpu usage monitor of current-process
- this should be used in a worker thread, it will creat 6 setInterval(1s,5s,10s,20s,30s,60s), use it in main process is NOT good
install
- npm install nv-linux-cpu-usage
splitted
usage
const x = require("nv-linux-cpu-usage");
example
> x._10s.start()
> x._10s
Cpusage [1 2023-05-01T11:54:09.852Z] { intv: 10000 }
> x._10s
Cpusage [1 2023-05-01T11:54:09.852Z] { intv: 10000 }
> x._10s
Cpusage [0.2877386363636364 2023-05-01T11:54:19.859Z] { intv: 10000 }
> x._10s
Cpusage [0.2877386363636364 2023-05-01T11:54:19.859Z] { intv: 10000 }
> x._10s
Cpusage [0.2877386363636364 2023-05-01T11:54:19.859Z] { intv: 10000 }
>
> x._10s
Cpusage [0.2877386363636364 2023-05-01T11:54:19.859Z] { intv: 10000 }
> x._10s
Cpusage [0.2877386363636364 2023-05-01T11:54:19.859Z] { intv: 10000 }
> x._10s
Cpusage [0.2585454545454546 2023-05-01T11:54:29.866Z] { intv: 10000 }
>
> x._10s
Cpusage [0.2585454545454546 2023-05-01T11:54:29.866Z] { intv: 10000 }
>
> x._10s.percent
0.1617159090909091
> x._10s.stop()
> x._10s
Cpusage [inactive] { intv: 10000 }
>
>
METHODS
.start();
.stop();
.is_active()
.percent // getter
.lst_time // getter calculated at
APIS
{
from_shell: [Function: from_shell],
from_api: [Function: from_api],
random_delay: [AsyncFunction: random_delay],
creat: [Function: creat],
creat_and_start: [Function: creat_and_start],
_1s: Cpusage [inactive] { intv: 1000 },
_5s: Cpusage [inactive] { intv: 50000 },
_10s: Cpusage [inactive] { intv: 10000 },
_20s: Cpusage [inactive] { intv: 20000 },
_30s: Cpusage [inactive] { intv: 30000 },
_60s: Cpusage [inactive] { intv: 60000 }
}
LICENSE
- ISC