我在freebsd上试了一下,用的system函数调用freebsd的top命令。
<?php
  $a = system('top');
  echo $a;
  exit(0);
?>
win下我只知道mem命令,可以看到内存占用情况。
<?php
  $a = system('mem');
  echo $a;
  exit(0);
?>

解决方案 »

  1.   

    getrusage  和 memory_get_usage
      

  2.   

    1.memory_get_usage
    (PHP 4 >= 4.3.2)memory_get_usage -- Returns the amount of memory allocated to PHP
    只是查看到的是php所占的内存.要查看系统的应该要用系统命令,用system命令来进行.2.getrusage
    (PHP 3>= 3.0.7, PHP 4 )getrusage -- Gets the current resource usages
    不适用于windows平台.做法应该是一楼的做法.