You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HHVM implementation of XHProf includes two handy functions and a wrapper class to allow sub-function profiling:
xhprof_frame_begin : Starts an artificial frame. Together with xhprof_frame_end(), this times one block of code execution as if it were a function call, allowing people to define arbitrary function boundaries. Prefer to use XhprofFrame classobjects instead of calling this function directly.
xhprof_frame_end : Ends an artificial frame that xhprof_frame_begin() started. One has to make sure there are no exceptions in between these two calls, as otherwise, it may report incorrect timings. Also, xhprof_frame_begin() and xhprof_frame_end() have to be paired up really well, so not to interfere with regular function's profiling, unless that's the intention. Prefer to use XhprofFrame classobjects instead of calling this function directly.
XhprofFrame : Wrapper object that calls xhprof_frame_begin in its constructor and xhprof_frame_end in its destructor.
class XhprofFrame {
public function __construct($name) {
xhprof_frame_begin($name);
}
public function __destruct() {
xhprof_frame_end();
}
}
The text was updated successfully, but these errors were encountered:
It looks to me like the implementation of these functions would be relatively straight forward wrappers around the BEGIN_PROFILING/END_PROFILING macros.
Having this support in the XHProf pecl extension would be very nice for libraries that are concerned about sub-function profiling and attempting to be compatible with both the PHP5 and HHVM interpreters.
The HHVM implementation of XHProf includes two handy functions and a wrapper class to allow sub-function profiling:
The text was updated successfully, but these errors were encountered: