-
Notifications
You must be signed in to change notification settings - Fork 921
Open
Description
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();
}
}
Metadata
Metadata
Assignees
Labels
No labels