getrusage_basic.phpt 820 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test getrusage() function: basic test
  3. --SKIPIF--
  4. <?php
  5. if( substr(PHP_OS, 0, 3) == "WIN" )
  6. die("skip.. Do not run on Windows");
  7. ?>
  8. --FILE--
  9. <?php
  10. /* Prototype : array getrusage ([ int $who ] )
  11. * Description: Gets the current resource usages
  12. * Source code: ext/standard/microtime.c
  13. * Alias to functions:
  14. */
  15. echo "Simple testcase for getrusage() function\n";
  16. $dat = getrusage();
  17. if (!is_array($dat)) {
  18. echo "TEST FAILED : getrusage shoudl return an array\n";
  19. }
  20. // echo the fields which are common to all platforms
  21. echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n";
  22. echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n";
  23. ?>
  24. ===DONE===
  25. --EXPECTF--
  26. Simple testcase for getrusage() function
  27. User time used (seconds) %d
  28. User time used (microseconds) %d
  29. ===DONE===