php/php-src — pull request #930 by beberlei (2014-12-02 19:30:52+00:00)
Title: Add timing to garbage collection when system supports gettimeofday().

This allows Profilers that hook into the zend_execute stack to gather information about the total time of garbage collection, or depending on the implementation even time of GC in a single function call.

Currently Profilers cannot get this information and therefore the resulting data can be very misleading if the GC is triggered accidently during various function calls.

The inclusion of this change is debatable, first its really only necessary for Profilers, adding overhead of the `gettimeofday` call in any case. However given that GC is triggered in very rare cases this might be considered OK. Composer for multi second long calls only triggers this cleanup 174 times (Reference: https://github.com/composer/composer/pull/3482#issuecomment-65252283)

The other approach could be to make `gc_collect_cycles` hookable by changing it to a function pointer.