Open In App

Node.js process.resourceUsage() Function

Last Updated : 06 Apr, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require() function.

process.resourceUsage() is a new method that returns resource usage for the current process.

Syntax:

process.resourceUsage()

Parameters: This function does not accept any parameter.

Return Value: It returns the resource usage for the current process. All of these values come from the uv_getrusage call which returns a uv_rusage_t struct.

Below examples illustrate the use of the process.resourceUsage() property in Node.js:

Example:

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());


Command to run:

node index.js

Output:

Note: The above program will compile and run by using the node filename.js command.

Reference: https://nodejs.org/api/process.html#process_process_resourceusage


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads