Exemples

Exemple #1 Exemple avec Xhprof et la GUI optionnelle

  1. <?php
  2. xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
  3.  
  4. for ($i = 0; $i <= 1000; $i++) {
  5. $a = $i * $i;
  6. }
  7.  
  8. $xhprof_data = xhprof_disable();
  9.  
  10. $XHPROF_ROOT = "/tools/xhprof/";
  11. include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
  12. include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
  13.  
  14. $xhprof_runs = new XHProfRuns_Default();
  15. $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_testing");
  16.  
  17. echo "http://localhost/xhprof/xhprof_html/index.php?run={$run_id}&source=xhprof_testing\n";
  18.  
  19. ?>

L'exemple ci-dessus va afficher quelque chose de similaire à :

http://localhost/xhprof/xhprof_html/index.php?run=t11_4bdf44d21121f&source=xhprof_testing
LoadingChargement en cours