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

Ignore C functions in summary rbspy prints out #114

Merged
merged 2 commits into from
Feb 22, 2018

Conversation

jvns
Copy link
Collaborator

@jvns jvns commented Feb 22, 2018

Previously we were including C functions in the summary rbspy prints out. I think it's appropriate to include C functions in a flamegraph, but in the summary they were just causing confusion -- it would report something like "50% of time spend in unknown C function", when in reality those are all probably different C functions.

With this PR, "unknown C function" is only included in the summary if it's the only thing in the stack trace.

@jvns
Copy link
Collaborator Author

jvns commented Feb 22, 2018

Helps address #110 cc @segiddins

@segiddins
Copy link

This is great!

Time since start: 140s. Press Ctrl+C to stop.
Summary of profiling data so far:
% self  % total  name
 11.68    11.87  chop_basename - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/pathname.rb
  5.00     5.57  generate_available_uuid_list - /Users/segiddins/Development/Rainforest/Xcodeproj/lib/xcodeproj/proje
  4.50     9.63  + - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/pathname.rb
  3.88     6.92  block (2 levels) in resolver_specs_by_target - /Users/segiddins/Development/Rainforest/CocoaPods/lib
  3.29     6.75  write_object - /Users/segiddins/.gem/ruby/2.3.1/bundler/gems/Nanaimo-bc9267d49a64/lib/nanaimo/writer
  2.96     2.96  compare_stream - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/fileutils.rb
  2.87     7.03  cleanpath_aggressive - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/pathname.rb
  2.45     2.97  block in attribute - /Users/segiddins/Development/Rainforest/Xcodeproj/lib/xcodeproj/project/object_
  2.40     5.20  plus - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/pathname.rb
  2.10     2.12  build_file - /Users/segiddins/Development/Rainforest/Xcodeproj/lib/xcodeproj/project/object/build_ph
  1.91     3.82  relative_glob - /Users/segiddins/Development/Rainforest/CocoaPods/lib/cocoapods/sandbox/path_list.rb
  1.79     4.82  raw_value_for_attribute - /Users/segiddins/Development/Rainforest/Core/lib/cocoapods-core/specificat
  1.75    13.98  relative_path_from - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/pathname.rb
  1.75     2.38  prepare_value - /Users/segiddins/Development/Rainforest/Core/lib/cocoapods-core/specification/consum
  1.65     1.72  root? - /Users/segiddins/Development/Rainforest/Core/lib/cocoapods-core/specification.rb
  1.60     9.24  block in glob - /Users/segiddins/Development/Rainforest/CocoaPods/lib/cocoapods/sandbox/path_list.rb
  1.42     1.43  block (4 levels) in resolver_specs_by_target - /Users/segiddins/Development/Rainforest/CocoaPods/lib
  1.23    22.44  paths_for_attribute - /Users/segiddins/Development/Rainforest/CocoaPods/lib/cocoapods/sandbox/file_a
  1.23     1.96  block in delegating_block - /Users/segiddins/.rubies/2.3.1/lib/ruby/2.3.0/delegate.rb
  1.13     9.94  add_file_reference - /Users/segiddins/Development/Rainforest/CocoaPods/lib/cocoapods/project.rb

@jvns jvns merged commit f896818 into master Feb 22, 2018
@jvns jvns deleted the ignore-c-functions-summary branch February 22, 2018 21:11
@segiddins
Copy link

@jvns this is interesting, some of the methods that show up in the summary don't show up in the flamegraph at all...

@jvns
Copy link
Collaborator Author

jvns commented Feb 22, 2018

that makes sense -- methods that are too deep in the call stack can get filtered out of the flamegraph (because we only show methods that are more than 2 pixels wide when rendered). so if you have a method which is called in a lot of different places but adds up to maybe 5% of the time overall, it might not show up in the flamegraph but still be fairly important

if you really want to dive into why a certain method is being called and it's not obvious from the flamegraph it might be better to use the callgrind output to dig into what's going on (brew install qcachegrind will give you a tool that can visualize callgrind output)

@x-ji
Copy link

x-ji commented May 23, 2019

"<c function> - unknown" still seems to be showing up in the summary? (This app runs puma).

Screenshot 2019-05-23 17 22 15

I'm running rbspy in the Docker container with a base image of ruby2.5-alpine. I added SYS_PTRACE via cap_add in docker-compose.yml.

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

3 participants