Node.js process.resourceUsage() Function
Last Updated :
06 Apr, 2021
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
const process = require( 'process' );
console.log(process.resourceUsage());
|
Command to run:
node index.js
Output:
![](https://media.geeksforgeeks.org/wp-content/uploads/20210309005126/WhatsAppImage20210309at125044AM-300x187.jpeg)
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
Share your thoughts in the comments
Please Login to comment...