-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Ability to time individual hooks #309
Comments
Yep, using Using hooks though makes it difficult to (automatically and simply) make sure the timer starts before other attached hooks... you could do something like I think lapping would be really cool too:
|
Point of clarity: I seem to recall seeing a negative priority on a hook, but don’t recall when or where. |
Yeah QM makes use of negative integers itself, usually The internal timer could maybe check to see if another action is hooked on an earlier priority and warn you. I'll have a play around. |
I've started on a PR for timing hooks. Here's the code I tested with: add_action( 'temp', 'qm_start', 0 );
add_action( 'temp', 'qm_lap', 9 );
add_action( 'temp', 'qm_lap', 11 );
add_action( 'temp', 'qm_stop', 9999 );
add_action( 'temp', function() { sleep( 2 ); } );
add_action( 'init', function() { do_action( 'temp' ); } ); The result is this: I can't seem to figure out though, @johnbillion Can you please advise on how to have QM select and display the correct component? |
Related: #260 |
Related: #340 |
Via @crstauf on #301 (comment):
Possible to add
qm/start
/qm/stop
onto a hook, and if there's no param (function name) provided, assumecurrent_action()
?QM could enable this via a wrapper function such as
qm_start()
andqm_stop()
which would then be used like this:Maybe even only require the start action and QM adds the stop action itself.
The text was updated successfully, but these errors were encountered: