Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xhprof_frame_begin & xhprof_frame_end #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bd808
Copy link

@bd808 bd808 commented Nov 28, 2014

Add functions for 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.
  • 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.
  • XhprofFrame : Wrapper object that calls xhprof_frame_begin in its
    constructor and xhprof_frame_end in its destructor.

This functionality was back ported from HHVM's internal XHProf
implementation. There has been one small change from the HHVM
implementation with the addition of the optional $wrapped boolean
parameter to xhprof_frame_begin which is used to fix a bug in the
upstream XhprofFrame implementation which mis-attibutes function calls
in a frame introduced via XhprofFrame to XhprofFrame::__construct
rather than the name provided for the frame.

Fixes #51

Add functions for 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.

- `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.

- `XhprofFrame` : Wrapper object that calls `xhprof_frame_begin` in its
  constructor and `xhprof_frame_end` in its destructor.

This functionality was back ported from HHVM's internal XHProf
implementation. There has been one small change from the HHVM
implementation with the addition of the optional `$wrapped` boolean
parameter to `xhprof_frame_begin` which is used to fix a bug in the
upstream `XhprofFrame` implementation which mis-attibutes function calls
in a frame introduced via `XhprofFrame` to `XhprofFrame::__construct`
rather than the name provided for the frame.
@bd808
Copy link
Author

bd808 commented Dec 28, 2014

Ping

return;
}

function prodedural() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

procedural ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. Fixed in f9829f6.

prodedural -> procedural
@bd808
Copy link
Author

bd808 commented Dec 2, 2015

🎂 I meant to ping on 2015-11-28, but better late than never as the Hallmark® cards tell me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for HHVM compatible xhprof_frame_begin & xhprof_frame_end
2 participants