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 performance counters to ConsoleSubsriber #1157

Closed
patrickkusebauch opened this issue Apr 22, 2023 · 4 comments · Fixed by #1162
Closed

Add performance counters to ConsoleSubsriber #1157

patrickkusebauch opened this issue Apr 22, 2023 · 4 comments · Fixed by #1162

Comments

@patrickkusebauch
Copy link
Collaborator

It is nice that we inform users running in verbose mode as we are progressing, but we do not provide any numbers regarding how much time each part (Ast building, dependency resolution) takes.

Can we add some timers to ConsoleSubsriber that would give the user timing info about how long did it take between each step?

@rubenrubiob
Copy link
Contributor

rubenrubiob commented Apr 23, 2023

I could take this issue next week. As far as I checked, it seems to be enough to add a counter to ConsoleSubscriber. Since it is already installed as a dependency, it would be possible to use Symfony Stopwatch component to keep the track of the time. I would make it an explicit dependency.

I do not know if it would be useful to add a writeLineFormattedWithTime(string|array $message, int $durationInMiliseconds) to OutputInterface, to concatenate the time there, also converting it to seconds.

Is there anything else I should take into account?

@patrickkusebauch
Copy link
Collaborator Author

Looking at the implementation, please don't. It is not precise enough. use https://www.php.net/manual/en/function.hrtime.php.

@rubenrubiob
Copy link
Contributor

rubenrubiob commented Apr 25, 2023

Okay, I will use hrtime. Should I create something like a Stopwatch service? O should I keep it simple and keep track of the time in the OutputFormatter.

I do not want to overengineer it, but I also do not want to create hard to maintain code. So tell me what you prefer :)

@patrickkusebauch
Copy link
Collaborator Author

I did this: d73d89a But feel free to do something more elaborate.

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

Successfully merging a pull request may close this issue.

2 participants