如何找出Node.js进程的CPU使用率百分比? [英] How to find out the % CPU usage for Node.js process?
问题描述
有没有一种方法可以使用代码找出node.js进程的%cpu使用率?这样,当node.js服务器正在运行并且检测到CPU超过一定百分比时,它将放置警报或控制台输出。
is there a way to find out the % cpu usage for a node.js process with the code? so that when the node.js server is running and detect the CPU is over certain%, then it will put an alert or console output.
推荐答案
尝试查看以下代码: https://github.com/last/healthjs
用于获取远程系统CPU的网络服务并接收CPU使用率警报...
Network service for getting CPU of remote system and receiving CPU usage alerts...
Health.js提供2种主要模式:流模式和事件模式。流模式允许客户端连接和接收流CPU使用情况数据。事件模式使Health.js在CPU使用率达到一定阈值时通知远程服务器。两种模式可以同时运行...
Health.js serves 2 primary modes: "streaming mode" and "event mode". Streaming mode allows a client to connect and receive streaming CPU usage data. Event mode enables Health.js to notify a remote server when CPU usage hits a certain threshold. Both modes can be run simultaneously...
这篇关于如何找出Node.js进程的CPU使用率百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!