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

Question: how to aggregate results from multiple profile calls (e.g. web requests) #5185

Closed
greghuc opened this issue May 23, 2018 · 2 comments

Comments

@greghuc
Copy link

greghuc commented May 23, 2018

Environment

jruby -v
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 10.0.1+10 on 10.0.1+10 +jit [linux-x86_64]

Question

Is there a way to aggregate results from multiple calls to JRuby::Profiler.profile, and view as a single output?

For context, I'm profiling a Roda API endpoint (example code below). So I'd like to make 10,000 GET calls to https://localhost/api/work, hit Ctrl-C on the web server, and see the profile.flat/profile.graph results.

From reading the Profile JRuby, it looks like each JRuby::Profiler.profile call on each GET will generate profile_data, but I can't see a way of aggregating the profile_data together for output on server exit.

Is this possible? If so, it would be great if the wiki page was updated.

Many thanks

class App < Roda 
   route do |r|
      r.on 'work' do
         profile_data = JRuby::Profiler.profile do
           # code to be profiled
         end
      end
   end
end

# On server shutdown, output aggregated profile data 
@kares
Copy link
Member

kares commented Jun 14, 2018

not sure if aggregating is needed really to be implemented in general.
you could "aggregate" the profile_data yourself or simply (which is usually how its done) profile at a higher level - somewhere at the framework router level I guess.

@greghuc
Copy link
Author

greghuc commented Jun 14, 2018

@kares thanks for the reply. In the end I just changed the API endpoint to repeat its logic 1000 times inside the profile call. This gave me enough information to debug the API, and avoid needing to aggregate profiling information from multiple API calls. Closing this issue.

@greghuc greghuc closed this as completed Jun 14, 2018
@kares kares added this to the Invalid or Duplicate milestone Jun 14, 2018
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

No branches or pull requests

2 participants