Login   Register  
PHP Classes
elePHPant
Icontem

File: showload.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Helmut Daschnigrum  >  CPU Load Calculator  >  showload.php  >  Download  
File: showload.php
Role: Example script
Content type: text/plain
Description: Example script
Class: CPU Load Calculator
Retrieve the CPU load level under Linux
Author: By
Last change:
Date: 8 years ago
Size: 774 bytes
 

Contents

Class file image Download
<?php
require_once("class_CPULoad.php");

// NOTE: Calling $cpuload->get_load() requires that your webserver has
// write access to the /tmp directory!  If it does not have access, you
// need to edit class_CPULoad.php and change the temporary directory.
$cpuload = new CPULoad();
$cpuload->get_load();
$cpuload->print_load();

echo 
"<br>$cpuload->cached The average CPU load is: ".$cpuload->load["cpu"]."%<br>\n";

/*
// This is an alternate way to get the CPU load.  This may return more
// accurate CPU load averages than the previous method (especially if
// your site isn't very busy), but it will cause your script to pause
// for 1 full second while processing.

$cpuload = new CPULoad();
$cpuload->sample_load();
$cpuload->print_load();
*/

?>