Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
803 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Benchmark à travers plusieurs script ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Benchmark à travers plusieurs script ?

n°1464578
supermofo
Hello World !
Posté le 25-10-2006 à 10:03:22  profilanswer
 

Bonjour
 
Est t'il possible de faire benchmark qui prendrait en compte un trajet dans plusieurs scripts ?
 
Par exemple sur 3 scripts:
 
1er :

Code :
  1. $time_start = microtime();
  2. //app.php
  3. switch($var){
  4. case (1) :
  5. $time_end = microtime();
  6. $time = getmicrotime($time_end) - getmicrotime($time_start);
  7. affiche_1($time);
  8. break;
  9. case (2) :
  10. affiche_3();
  11. break;


2eme:
functions.php

Code :
  1. function affiche_1(){
  2. global config;
  3. $var1 = 'truc';
  4. require_once('template.php');
  5. $time_start = $time;
  6. }


3eme fichier template.php

Code :
  1. <html><?php echo $var1 ?></html>
  2. <?php
  3. $time_end = microtime();
  4. echo $time_total= getmicrotime($time_end) - getmicrotime($time)


 
Pour l'instant j'ai pensé que passé en argument au fonction du switch le temp $time = $time_end - $time_start, et le recuperer ainsi de suite a traver les scripts marcherait.
Malheureusement les temps recuperes sont soit sous la forme 3.10E-5, soit sous la forme 11004,2355. Normalement je devrais recevoir ceci
 

Code :
  1. $time_start=microtime();
  2. ...
  3. $time_end = microtime();
  4. $time = getmicrotime($time_end) - getmicrotime($time_start); //0 . 00001456


 
Merci d'avance


Message édité par supermofo le 25-10-2006 à 10:04:27
mood
Publicité
Posté le 25-10-2006 à 10:03:22  profilanswer
 

n°1465020
misterping​uin
Posté le 25-10-2006 à 18:52:49  profilanswer
 

function benchmark($timer1) {
  $timer2 = microtime();
  $timer2 = substr($timer2,strpos($timer2," " )) + substr($timer2,0,strpos($timer2," " ));
  $timer1 = substr($timer1,strpos($timer1," " )) + substr($timer1,0,strpos($timer1," " ));
  return round($timer2-$timer1,2);
}

n°1465031
masklinn
í dag viðrar vel til loftárása
Posté le 25-10-2006 à 19:54:09  profilanswer
 

La meilleure idée serait d'utiliser un profiler


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
n°1465096
supermofo
Hello World !
Posté le 25-10-2006 à 22:50:42  profilanswer
 

Pardon je ne sais ce qu'est un profiler ..
 
OK misterpinguin


Message édité par supermofo le 25-10-2006 à 22:53:30
n°1465101
masklinn
í dag viðrar vel til loftárása
Posté le 25-10-2006 à 22:58:33  profilanswer
 

http://www.google.fr/search?q=define%3Aprofiler


Message édité par masklinn le 25-10-2006 à 22:58:54

---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
n°1465103
supermofo
Hello World !
Posté le 25-10-2006 à 23:01:39  profilanswer
 

Ok génial merci j'ai trouvé mon bonheur du coté de xdebug.


Message édité par supermofo le 25-10-2006 à 23:03:56
n°1465440
supermofo
Hello World !
Posté le 26-10-2006 à 14:13:43  profilanswer
 

Avec smarty cache activé:

Code :
  1. Overview
  2. ================================================================================
  3. Report name:                  10/26/2006 1:44:12 PM
  4. Run on:                       26/10/2006 13:44:12
  5. Run length:                   00:05:20
  6. Web Application Stress Tool Version:1.1.293.1
  7. Number of test clients:       1
  8. Number of hits:               4912
  9. Requests per Second:          16.37
  10. Socket Statistics
  11. --------------------------------------------------------------------------------
  12. Socket Connects:              4912
  13. Total Bytes Sent (in KB):     983.36
  14. Bytes Sent Rate (in KB/s):    3.28
  15. Total Bytes Recv (in KB):     14707.43
  16. Bytes Recv Rate (in KB/s):    49.01
  17. Socket Errors
  18. --------------------------------------------------------------------------------
  19. Connect:                      0
  20. Send:                         0
  21. Recv:                         25
  22. Timeouts:                     0
  23. RDS Results
  24. --------------------------------------------------------------------------------
  25. Successful Queries:           0
  26. Script Settings
  27. ================================================================================
  28. Server:                       127.0.0.1
  29. Number of threads:            60
  30. Test length:                  00:05:00
  31. Warmup:                       00:00:10
  32. Cooldown:                     00:00:10
  33. Use Random Delay:             No
  34. Follow Redirects:             Yes
  35. Max Redirect Depth:           15
  36. Clients used in test
  37. ================================================================================
  38. localhost
  39. Clients not used in test
  40. ================================================================================
  41. Result Codes
  42. Code      Description                   Count   
  43. ================================================================================
  44. 200       OK                            4880     
  45. NA        HTTP result code not given    32       
  46. Page Summary
  47. Page                            Hits      TTFB Avg  TTLB Avg  Auth      Query   
  48. ================================================================================
  49. GET /inter/rottpic/app.php      4912      3573.83   3593.68   No        No


 
Sans smarty sans cache:

Code :
  1. Overview
  2. ================================================================================
  3. Report name:                  10/26/2006 1:59:43 PM
  4. Run on:                       26/10/2006 13:59:43
  5. Run length:                   00:05:21
  6. Web Application Stress Tool Version:1.1.293.1
  7. Number of test clients:       1
  8. Number of hits:               10207
  9. Requests per Second:          34.02
  10. Socket Statistics
  11. --------------------------------------------------------------------------------
  12. Socket Connects:              10208
  13. Total Bytes Sent (in KB):     2043.59
  14. Bytes Sent Rate (in KB/s):    6.81
  15. Total Bytes Recv (in KB):     13613.60
  16. Bytes Recv Rate (in KB/s):    45.37
  17. Socket Errors
  18. --------------------------------------------------------------------------------
  19. Connect:                      2
  20. Send:                         0
  21. Recv:                         5
  22. Timeouts:                     0
  23. RDS Results
  24. --------------------------------------------------------------------------------
  25. Successful Queries:           0
  26. Script Settings
  27. ================================================================================
  28. Server:                       127.0.0.1
  29. Number of threads:            60
  30. Test length:                  00:05:00
  31. Warmup:                       00:00:10
  32. Cooldown:                     00:00:10
  33. Use Random Delay:             No
  34. Follow Redirects:             Yes
  35. Max Redirect Depth:           15
  36. Clients used in test
  37. ================================================================================
  38. localhost
  39. Clients not used in test
  40. ================================================================================
  41. Result Codes
  42. Code      Description                   Count   
  43. ================================================================================
  44. 200       OK                            10168   
  45. NA        HTTP result code not given    39       
  46. Page Summary
  47. Page                            Hits      TTFB Avg  TTLB Avg  Auth      Query   
  48. ================================================================================
  49. GET /inter/rottpic/app.php      10207     1672.87   1675.33   No        No


 
Script de test:
 

Code :
  1. require_once(CONFIG_SQL);
  2. //get 10 random dogs and fetch
  3. open_db();
  4. $query = 'SELECT dogs.id,dogs.name,dogs.father,dogs.mother, photos.thumb_file FROM dogs LEFT JOIN photos on dogs.id=photos.dog_id ORDER BY RAND() LIMIT 5';
  5. $res = mysql_query($query);
  6. while($row = mysql_fetch_assoc($res)){
  7.  $dogs[] = $row;
  8. }
  9. mysql_free_result($res);
  10. require_once(TEMPLATE_DIR . 'accueil.php');
  11. /*
  12. //template noob
  13. require('Smarty.class.php');
  14. $smarty = new Smarty;
  15. $smarty->template_dir = TEMPLATE_DIR;
  16. $smarty->config_dir =  CONFIG_DIR;
  17. $smarty->cache_dir = './smarty/cache';
  18. $smarty->compile_dir = './smarty/templates_c';
  19. $smarty->caching = 1;
  20.  
  21.  
  22. $smarty->assign('dogs',$dogs);
  23.  
  24.  
  25.   $smarty->display('accueil.tpl');


 
Conclusion: Smarty avec caching est deux fois plus lent qu'un template en include dans mon cas  :bounce:


Message édité par supermofo le 26-10-2006 à 14:57:28

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Benchmark à travers plusieurs script ?

 

Sujets relatifs
[Perl] script utilisant les pipe unix, sql, et p'tet forkAppel de fonction dans plusieurs fichiers
Appel d'une fonction dans plusieurs fichiersLes bases de la création d'un script en C
[Résolu][XHTML/Javascript/W3C] Problème de XHTML dans un Javascript[SCRIPT UNIX]Pb avec sed
script multi upload multi site[oracle] script affichant base connecté
Script de connexion WSH[Résolu][Script aculo us] Sortable.create
Plus de sujets relatifs à : Benchmark à travers plusieurs script ?


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)