-
Notifications
You must be signed in to change notification settings - Fork 88
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 ability to profile commands via CLI #116
Conversation
``` | ||
$ ruby-memory-profiler [options] <script.rb> [--] [script-options] |
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.
CLI allows to profile single files or whole command. Since single files can be profiled as commands via simply ... ruby script.rb ...
, I removed that ability from the readme to make it less confusing and for people to use the unified style.
REPORTER_KEYS = [ | ||
:top, :trace, :ignore_files, :allow_files | ||
].freeze | ||
|
||
RESULTS_KEYS = [ | ||
:to_file, :color_output, :retained_strings, :allocated_strings, | ||
:detailed_report, :scale_bytes, :normalize_paths | ||
].freeze |
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.
This separation is really not needed and only complicates the code.
CI is red not because of this PR changes - needs to be fixed separately. |
I like this change a lot, merging |
The base64 gem needs to be added to the gemspec. It will not be a default gem anymore in Ruby 3.4, for RuboCops head CI this causes a failure like this: rubocop/rubocop#13002 |
Closes #113.
Closes #114.
Currently, the CLI allows to profile only ruby files. But when you want to profile a whole ruby command for its entire lifetime, it's a bit complicated to find the proper entry point and exit point to insert
MemoryProfiler.start
etc.This PR extends the CLI to allow to do this easily, e.g:
Or for profiling a Rails application boot sequence:
Or a user's rake task: