Php detection server running

Source: Internet
Author: User
The detection function supports functionisfun ($ funName) {return (false! Function_exists ($ funName ))? & Amp; 39; supported & amp; 39;: & amp; 39; & lt; fontcolorred & gt; not supported & lt; font & gt; & amp;
  1. // Detection function support
  2. Function isfun ($ funName ){
  3. Return (false! = Function_exists ($ funName ))? 'Supported ': 'unsupported ';
  4. }
  5. // Integer computing capability test
  6. Function test_int (){
  7. $ TimeStart = gettimeofday ();
  8. For ($ I = 0; I I <3000000; $ I ++ ){
  9. $ T = 1 + 1;
  10. }
  11. $ TimeEnd = gettimeofday ();
  12. $ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
  13. $ Time = round ($ time, 3). "seconds ";
  14. Return $ time;
  15. }
  16. // Floating point computing capability test
  17. Function test_float (){
  18. // Obtain the circumference rate
  19. $ T = pi ();
  20. $ TimeStart = gettimeofday ();
  21. For ($ I = 0; I I <3000000; $ I ++ ){
  22. // Square
  23. Sqrt ($ t );
  24. }
  25. $ TimeEnd = gettimeofday ();
  26. $ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
  27. $ Time = round ($ time, 3). "seconds ";
  28. Return $ time;
  29. }
  30. // IO capability test
  31. Function test_io (){
  32. $ Fp = @ fopen (PHPSELF, "r ");
  33. $ TimeStart = gettimeofday ();
  34. For ($ I = 0; I I <10000; $ I ++ ){
  35. @ Fread ($ fp, 10240 );
  36. @ Rewind ($ fp );
  37. }
  38. $ TimeEnd = gettimeofday ();
  39. @ Fclose ($ fp );
  40. $ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
  41. $ Time = round ($ time, 3). "seconds ";
  42. Return ($ time );
  43. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.