Skip to content

Add support for HHVM compatible xhprof_frame_begin & xhprof_frame_end #51

@bd808

Description

@bd808

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions