-
Notifications
You must be signed in to change notification settings - Fork 324
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
feat(cli): Add the flag --monitor-stack-traces
#7391
Conversation
If `ort` executes slowly this can become handy for getting a first hint where the CPU work is happening. Note: Print the stack traces in reverse order and the `main` thread's trace at the bottom to have the likely desired information at the most prominent place. Signed-off-by: Frank Viernau <[email protected]>
508fd0a
to
197186b
Compare
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #7391 +/- ##
=========================================
Coverage 61.03% 61.03%
Complexity 1968 1968
=========================================
Files 336 336
Lines 16503 16503
Branches 2349 2349
=========================================
Hits 10073 10073
Misses 5454 5454
Partials 976 976
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hmm, I'm unsure whether this is a feature that we should add. It sounds more like something that should be done during debugging with the means of an IDE. Or are there really cases you'd like to inspect e.g. on CI that absolutely cannot be reproduced locally? Also, this reminds me a bit of #3296. IMO a much nicer (but also more involving) solution for monitoring would be to print better progress information on the CLI, similar to like Gradle does when building with multiple threads in parallel. |
Can you explain which exact means you are referring to, and why these means should be preferable.
It's not for CI, it's for local investigations. It could also be local on some other devs machine, so remote to myself.
In my use case the CLI output of ORT just didn't print anything, so I wanted to get a hunch on what it's doing. And this can be a very quick way to do so IMO. If one could anticipate all performance problems and put logging making it visible everywhere, then the performance problem wouldn''t exist in the first place. I've written this code already a couple of times and I wanted to save that effort for myself and others as well. Would it work for you if this feature was toggled via env var instead via a CI param, or is the feature itself not convincing? |
I wasn't thinking about using a profiler, but the threads view of the debugger tab in the IDE. You can pause execution of threads and look at the stacktrace at any time.
Since it's you who wants to introduce this change, could you please explain why your approach should be preferred over dedicated debugging tools?
Yes, that's exactly what #3296 is about: Missing information about progress. This should not necessarily be implemented by simply adding more log statement, but ideally by implementing progress interfaces. But that's, as mentioned, a bigger effort.
I don't get that sentence. How does more logging automatically solve performance problems?
Obviously, I cannot tell for the rest of @oss-review-toolkit/kotlin-devs, but I myself have never needed it / more than what the IDE debugging offers.
To me, the feature itself is not convincing, as it seems to reimplement something that is already available in the IDE, or via some of the tools e.g. mentioned here. |
I believe I just did that. It's quicker than doing it in the IDE IMO.
Your previous message implied to me that one would need to be able to foresee performance issues, in order to do the log statements such that it's visible from the logs where the performance issue is. I just wanted to point out that this assumption does not hold.
I run ort via |
@@ -104,6 +106,8 @@ class OrtMain : CliktCommand( | |||
"--debug" to Level.DEBUG | |||
).default(Level.WARN) | |||
|
|||
private val monitorStackTraces by option(help = "Continuously print out the stack traces of all threads.").flag() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if the option would take in int value to configure the interval.
|
If
ort
executes slowly this can become handy for getting a first hint where the CPU work is happening.Note: Print the stack traces in reverse order and the
main
thread's trace at the bottom to have the likely desired information at the most prominent place.