PHP code example of myziyue / xhprof

1. Go to this page and download the library: Download myziyue/xhprof library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

myziyue / xhprof example snippets



tion foo() {
  for ($idx = 0; $idx < 5; $idx++) {
    bar($idx);
    $x = strlen("abc");
  }
}

\myziyue\xhprof\ZyXhprof::startProfiling(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);

// run program
foo();

\myziyue\xhprof\ZyXhprof::stopProfiling('demo');

fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/vendor/myziyue/xhprof/ZyPreInject.php";
fastcgi_param PHP_VALUE "auto_append_file=/var/www/vendor/myziyue/xhprof/ZyEndInject.php";


auto_prepend_file=/var/www/vendor/myziyue/xhprof/ZyPreInject.php;
auto_append_file=/var/www/vendor/myziyue/xhprof/ZyEndInject.php;