-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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 profiling tools #13057
Add profiling tools #13057
Conversation
093dc9d
to
e9c859a
Compare
This is beautiful! |
@@ -39,12 +39,56 @@ def spinner | |||
end | |||
end | |||
|
|||
def start_profiler |
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.
As a note, since this is more generic than just the code in this file I would prefer it to live in a more generic place where it could be started (and possibly stopped) independent of the framework console. Somewhere like lib/metasploit/framework/profile.rb
or lib/msf/core/profile.rb
should work.
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.
Sounds good, thanks!
I've ripped it out, and ensured that it can be called from msfvenom too 👍
904b6b2
to
8297a31
Compare
Release NotesProfiling tools for looking at memory and CPU utilization have been added. |
Continuing on the awesome work from #12652 this PR adds profiling tools for CPU and memory.
METASPLOIT_CPU_PROFILE
Generates various useful reports.
Stack view
Graph view
There is also an ascii flat view.
Note This uses ruby-prof under the hood, to generate a different style of report you can supply additional ENV args. The default value is RubyProf::WALL_TIME. You may can specify the measure mode by using the RUBY_PROF_MEASURE_MODE environment variable:
METASPLOIT_MEMORY_PROFILE
Although the cpu/ruby-prof report can give similar insights, the memory profile can be easier to understand:
Enabling
After setting the environment variables, metasploit will now begin profiling.
METASPLOIT_CPU_PROFILE=true ./msfconsole
METASPLOIT_MEMORY_PROFILE=true ./msfconsole
The report will be generated when metasploit exits.
Verification
List the steps needed to make sure this thing works
Verify
METASPLOIT_CPU_PROFILE=true ./msfconsole -x 'exit'
creates various CPU profile reportsVerify
METASPLOIT_MEMORY_PROFILE=true ./msfconsole -x 'exit'
creates various memory profile reportsVerify
METASPLOIT_CPU_PROFILE=true ./msfvenom -x 'exit'
creates various CPU profile reportsVerify
METASPLOIT_MEMORY_PROFILE=true ./msfvenom -x 'exit'
creates various memory profile reports