Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> benchmark, czy jest dobry
SoulSeduction
post 22.10.2005, 18:41:09
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 16.07.2005

Ostrzeżenie: (0%)
-----


Witam
Szukałem na sieci jakiegos benchamrk'u dla php i znalazłem to, ale nie wiem czy jest dobry.

poniżej zamieszczam kod

  1. <?php
  2.  
  3. /*
  4. php Performance Benchmark Script
  5. Copyright 2003  php Consulting
  6. There are two settings:
  7.    First, set $file to be the server and page that you want to benchmark.
  8.    Secondly, set $iter to be the number of times you want it loaded.
  9. */
  10.  
  11.  
  12. $file = "http://localhost/strona.php";
  13. $iter = 100;
  14.  
  15.  
  16. function getmtime()
  17. {
  18. $a = explode (' ',microtime());
  19. return(double) $a[0] + $a[1];
  20. }
  21.  
  22. for ($i = 0; $i < $iter; $i++)
  23. {
  24. $start = getmtime();
  25. file ($file);
  26. $loadtime += getmtime() - $start ;
  27. $intertime = getmtime() - $start ;
  28. echo $intertime . "<br>" ;
  29. $avgload = $loadtime / $iter;
  30. }
  31. echo "<p><b>" . $avgload . "</b>" ;
  32.  
  33. ?>


Z góry dzięki za odpowiedź.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
dr_bonzo
post 22.10.2005, 19:41:32
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

Ostrzeżenie: (0%)
-----


Bardzo prosty -- ale po co uzywac file() (wolne) zamiast np. file_get_contents().
Pobaw sie programem 'ab' -- dostarczany razem z apachem. Ew bardziej zaawansowanym profillerem (chyba w Zend Studio/Serwer jest).


--------------------
Nie lubię jednorożców.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 06:46