A PHP Valgrind tool
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
CREDITS
EXPERIMENTAL
README.md
config.m4
config.w32
php_valgrind.h
valgrind.c

README.md

php-valgrind

A PHP valgrind tool, it can be used to toggle collect in PHP scripts

<?php
$a =array();
callgrind_toggle();
for ($i=0;$i<100;$i++) {
   $a[$i] = 2;
}
callgrind_toggle();
callgrind_dump();  //This is optional in this case

then you must run valgrind with auto-toggle and auto-instr both off

$valgrind --tool=callgrind --collect-atstart=no --instr-atstart=no php /tmp/1.php

//Output:
...
==3533== Events    : Ir
==3533== Collected : 2361260
==3533==
==3533== I   refs:      2,361,260

then you will get a callgrind.out.*, let's open it with qcachegrind(or kcachegrind, callgrind_annotate)

callgrind.out