• Stars
    star
    175
  • Rank 217,215 (Top 5 %)
  • Language
    C
  • Created about 11 years ago
  • Updated about 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PHP Valgrind tool

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