PHP getrusage() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The getrusage() function is an inbuilt function in PHP that returns current resource usage. Syntax: getrusage(int $mode = 0)Parameters: This function has only one parameter: $mode: This parameter will be called with RUSAGE_CHILDREN, if the mode will be 1.Return Value: This function returns an associative array that is called from the system call. All entries can be accessed by using their documented fields. If failed return false. Example 1: In the below example, will use getrusage() function and print swaps. PHP <?php $dat = getrusage(); // Number of swaps echo $dat["ru_nswap"]; ?> Output: 0 Example 2: In the below example, we will print the number of fault pages using getrusage() function. PHP <?php $dat = getrusage(); // User time used (seconds) echo $dat["ru_utime.tv_sec"]; // User time used (microseconds) echo $dat["ru_utime.tv_usec"]; ?> Output: 08624 Note: Output can be different according to the system. Reference: https://www.php.net/manual/en/function.getrusage.php Create Quiz Comment N neeraj3304 Follow 0 Improve N neeraj3304 Follow 0 Improve Article Tags : PHP PHP-function Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like