-
Notifications
You must be signed in to change notification settings - Fork 1
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 ad hoc calculation of elapsed time for selected hooks #87
Comments
Having recently developed a plugin that's all about performance improvement I'm now more interested in developing a solution that will enable easy reporting of elapsed time between hooks or for time spent while processing a a particular function. oik-bwtrace already supports logging of the total elapsed time and time since the last trace record but it doesn't Proposal
eg
|
I've started adding a very basic implementation that records the start time of each hook if not already set |
Changing the [hook] shortcode output didn't work well.
There's both too much information and not enough to make good use of it.
But if no logic acts on an action hook then it's probably not important to know that the hook was invoked. |
This helped. Now, if there was a particular action hook of interest, but which doesn't have any attached functions this can easily be alleviated by using oik action options. Just add the required hooks into the |
There are two options for this. 1. Simple hook - timing pointsFor a simple timeline of actions we can use the "Action timings" report. For any action which doesn't already have an implementation we can
There would be an oik-actions checkbox for this type of hook 2. Timer hookTo find out the elapsed time for a particular hook, and the average time for each invocation,
|
In Rarst's Laps plugin there's a list of core hooks that Laps is interested in:
These events could be the default events for timing points. See src/Events/Core_Events.php It also supports: Beaver Builder, Genesis, Hybrid Core, Theme Hook Alliance, WooCommerce and Yoast Laps shows the elapsed time for each plugin to load. It hooks into |
Having added the Plugin load times report I then attempted to reconcile the output with the trace records and the Action timings. Here's an edited version of the plugin load times report.
Here's the first part of Action timings
Observations
6. Jetpack hook into
|
I found some issues in the Jetpack repo where they had problems with other plugins using Here's the original issue. Automattic/jetpack#14720 |
In the trace output, when Include timestamp is selected, each trace record contains fields showing the elapsed time and the interval between the previous trace record and the next.
The first elapsed time of zero didn't take into account the fact that a lot of WordPress core had already been loaded. In the example below the code's been changed.
|
I need to check if the trace shutdown report and the daily trace summary figures were already correct wordpress/,,1.497586,8.0.2,1278,3843,358,1,584,31,14,7,43,0.06969141960144, |
…SERVER['REQUEST_TIME_FLOAT'] #87
This is now delivered in oik-bwtrace v3.3.1. It will be closed when released to wordpress.org. |
When attempting to analyse performance issues we don’t want to produce lots of trace records since this slows the system down. It would be nice to know, for selected hooks the total number of invocations and the total time spent in the hook.
This would help us to identify whether or not a hook which is invoked often takes up a large percentage of the total execution.
Note: There are some hooks, such as
init
, which can take ages because every man and his dog seems to want to make sure their routines are ready and poised for anything that could possibly be done.There are other hook functions which innocently do lots of things thinking they’ll only be called once.
The text was updated successfully, but these errors were encountered: