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

Adding option to track php functions time with adding actions in the … #301

Merged
merged 19 commits into from
Feb 8, 2018

Conversation

ivdimova
Copy link
Collaborator

…code that will be profilled
For #282

@johnbillion
Copy link
Owner

Yep this is exactly the sort of thing I was thinking, thanks. A few points:

  • The QM_Timer class can be used in place of manually calling microtime(). It supports starting, lapping, and stopping a timer and includes the time and memory usage. You can see this in use in the self-awareness output in the develop branch.
  • Probably will need to handle timers that were started but not stopped, with a useful warning message.
  • We'll need to consider overlapping timers. The start and stop properties in the collector might need to be converted to associative arrays keyed by the function name. Example that needs to be handled:
do_action( 'qm/start', 'function_1' );
do_action( 'qm/start', 'function_2' );
...
do_action( 'qm/stop', 'function_1' );
do_action( 'qm/stop', 'function_2' );

@johnbillion johnbillion added this to the 2.18.0 milestone Jan 31, 2018
@johnbillion johnbillion merged commit 9f0a487 into develop Feb 8, 2018
@eddr
Copy link

eddr commented Feb 8, 2018

Will you have to manually add "do_action" for each function you want to measure? if so, that's fine, but what about functions inside classes or if you want to get a measurement of the whole system at once?

@crstauf
Copy link
Contributor

crstauf commented Feb 8, 2018

@eddr Interesting idea: a single location where you could add all of your timers, rather than having to manually add into each function/method.

@johnbillion Possible to add qm/start/qm/stop onto a hook, and if there's no param (function name) provided, assume current_action()?

@johnbillion
Copy link
Owner

For now you'll need to manually call the actions (don't worry, I'm writing up some documentation for this feature), but some sort of automated measurements is a good idea and I'll look at it at a later date.

@crstauf Good idea, I like it. #309.

@johnbillion johnbillion deleted the 282/php-timing-hooks branch February 8, 2018 17:25
@johnbillion johnbillion modified the milestones: 2.18.0, 3.0.0 Apr 11, 2018
@crstauf
Copy link
Contributor

crstauf commented May 7, 2018

@johnbillion has the documentation for these functions been created? I'm attempting to implement, but doesn't look like lapping is being displayed in the output?

@crstauf
Copy link
Contributor

crstauf commented May 7, 2018

Addressed in #337 (comment)

@johnbillion johnbillion mentioned this pull request Jan 4, 2019
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.

None yet

4 participants