流程對象是一個全局對象,提供有關當前Node.js流程的信息並對其進行控製。全局而言,它始終可用於Node.js應用程序,而無需使用require()。也可以使用require()函數對其進行顯式訪問。
process.resourceUsage()是一種新方法,它返回當前進程的資源使用情況。
用法:
process.resourceUsage()
參數:此函數不接受任何參數。
返回值:它返回當前進程的資源使用情況。所有這些值都來自uv_getrusage調用,該調用返回uv_rusage_t結構。
以下示例說明了Node.js中process.resourceUsage()屬性的用法:
例:
index.js
// Node.js program to demonstrate the
// process.resourceUsage() Property
// Include process module
const process = require('process');
// Printing process.resourceUsage() property value
console.log(process.resourceUsage());
運行命令:
node index.js
輸出:
注意:上麵的程序將使用node filename.js命令編譯並運行。
參考:https://nodejs.org/api/process.html#process_process_resourceusage
相關用法
- Node.js GM charcoal()用法及代碼示例
- Node.js GM blur()用法及代碼示例
- Node.js GM sharpen()用法及代碼示例
- Node.js GM drawLine()用法及代碼示例
- Node.js GM drawArc()用法及代碼示例
- Node.js GM drawPolyline()用法及代碼示例
- Node.js GM drawBezier()用法及代碼示例
- Node.js GM drawCircle()用法及代碼示例
- Node.js GM drawEllipse()用法及代碼示例
- Node.js GM drawPolygon()用法及代碼示例
- Node.js GM drawRectangle()用法及代碼示例
- Node.js GM paint()用法及代碼示例
- Node.js GM orderedDither()用法及代碼示例
- Node.js GM roll()用法及代碼示例
- Node.js GM segment()用法及代碼示例
- Node.js GM quality()用法及代碼示例
- Node.js GM raise()用法及代碼示例
- Node.js GM resize()用法及代碼示例
- Node.js GM transparent()用法及代碼示例
- Node.js GM thumbnail()用法及代碼示例
- Node.js GM threshold()用法及代碼示例
- Node.js GM whitePoint()用法及代碼示例
- Node.js GM whiteThreshold()用法及代碼示例
注:本文由純淨天空篩選整理自subhammahato348大神的英文原創作品 Node.js process.resourceUsage() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。