Git Product home page Git Product logo

Comments (8)

bhb avatar bhb commented on August 31, 2024

Pete,

Sorry for the delayed reply - I've been on the road with spotty access to the internet. To answer your question, I think your problem is that you are not starting rackup in the 'profiling' environment. You can do so like this

 rackup -E profiling

or, you can alter the code in your app to be like this:

configure do
  use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
end

and just do:

rackup

That said, I can see how this is confusing, so I'll update the readme to be more clear. Let me know if this doesn't solve your problem.

from rack-perftools_profiler.

petewarden avatar petewarden commented on August 31, 2024

Thanks, that is helpful. I was including the configure do ... end statement
in the example code, but it didn't seem to be working correctly (possibly
because I placed it within the app class?). Adding the arguments to Rackup
does work, but I then run into a problem with pprof.rb not being found when
I pass in profile=true in the URL. I'll investigate further, ideally I'd
like to create a minimal standalone example that other newbies like me can
start with as a template.

Thanks again for your help!

On Mon, Aug 8, 2011 at 8:34 PM, bhb <
[email protected]>wrote:

Pete,

Sorry for the delayed reply - I've been on the road with spotty access to
the internet. To answer your question, I think your problem is that you are
not starting rackup in the 'profiling' environment. You can do so like this

rackup -E profiling

or, you can alter the code in your app to be like this:

configure do
 use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
end

and just do:

rackup

That said, I can see how this is confusing, so I'll update the readme to be
more clear. Let me know if this doesn't solve your problem.

Reply to this email directly or view it on GitHub:

#11 (comment)

from rack-perftools_profiler.

bhb avatar bhb commented on August 31, 2024

"I'll investigate further, ideally I'd like to create a minimal standalone
example that other newbies like me can start with as a template."

Sounds cool to me. I'm still on the road, but as soon as I get a chance,
I'll see if I can fork your sample project and make something simple that
works for me. Please let me know if you get stuck.

Ben

On Tue, Aug 9, 2011 at 1:54 PM, petewarden <
[email protected]>wrote:

Thanks, that is helpful. I was including the configure do ... end statement
in the example code, but it didn't seem to be working correctly (possibly
because I placed it within the app class?). Adding the arguments to Rackup
does work, but I then run into a problem with pprof.rb not being found when
I pass in profile=true in the URL. I'll investigate further, ideally I'd
like to create a minimal standalone example that other newbies like me can
start with as a template.

Thanks again for your help!

On Mon, Aug 8, 2011 at 8:34 PM, bhb <
[email protected]>wrote:

Pete,

Sorry for the delayed reply - I've been on the road with spotty access to
the internet. To answer your question, I think your problem is that you
are
not starting rackup in the 'profiling' environment. You can do so like
this

rackup -E profiling

or, you can alter the code in your app to be like this:

configure do
 use ::Rack::PerftoolsProfiler, :default_printer => 'gif'
end

and just do:

rackup

That said, I can see how this is confusing, so I'll update the readme to
be
more clear. Let me know if this doesn't solve your problem.

Reply to this email directly or view it on GitHub:

#11 (comment)

Reply to this email directly or view it on GitHub:

#11 (comment)

Ben Brinckerhoff
bbrinck.com
twitter.com/bbrinck

from rack-perftools_profiler.

bhb avatar bhb commented on August 31, 2024

Pete,

I think I see the problem. If you use rack-perftools_profiler, you don't need to call PerfTools::CpuProfiler directly - that's what the middleware does for you. Check out my fork (https://github.com/bhb/sinatraperftoolsexample) for a simple example that will provide profiling data if you visit http://localhost:9292/?profile=true

I hope that helps. Let me know if you have any other questions.

Ben

from rack-perftools_profiler.

petewarden avatar petewarden commented on August 31, 2024

That direct call was actually just some debugging code I mistakenly checked
in. I wanted to make sure that perftools was present and working on my
system, but didn't intend for it to be in the example. I've reverted the
code back to the original version, sorry about that.

What I'm basically trying to figure out with the sample code is how to make
a call to eg http://localhost:9292/?profile=true trigger a profile.

cheers,
Pete

On Fri, Aug 12, 2011 at 3:38 AM, bhb <
[email protected]>wrote:

Pete,

I think I see the problem. If you use rack-perftools_profiler, you don't
need to call PerfTools::CpuProfiler directly - that's what the middleware
does for you. Check out my fork (
https://github.com/bhb/sinatraperftoolsexample) for a simple example that
will provide profiling data if you visit
http://localhost:9292/?profile=true

I hope that helps. Let me know if you have any other questions.

Ben

Reply to this email directly or view it on GitHub:

#11 (comment)

from rack-perftools_profiler.

bhb avatar bhb commented on August 31, 2024

Strange. The code on my fork works for me. What do you see when you visit http://localhost:9292/?profile=true ?

If you see a message like "No nodes to print" or "Running the command 'pprof.rb --text /tmp/rack_perftools_profiler.prof' failed to generate a file"

it simply means that the code was so fast that it couldn't be profiled - basically, the profiler never even had a chance to take a sample. This usually only happens if the page is very simple (and therefore would not be interesting to profile anyway). To get around this, I recommend inserting some code like 5_000_000.times{ 1+2+3+4+5 } to artificially slow down the route so you can see some profiling data.

from rack-perftools_profiler.

petewarden avatar petewarden commented on August 31, 2024

Thanks Ben. I don't see any message in the logs, and the delivered page is
identical to the one served up without the profile argument.

It is helpful to know the application works for you though, since it
suggests the problem is with my machine's configuration, not the code. I'm
running it on my OS X laptop, so the next thing I'll try is a clean Ubuntu
EC2 box.

On Fri, Aug 12, 2011 at 2:25 PM, bhb <
[email protected]>wrote:

Strange. The code on my fork works for me. What do you see when you visit
http://localhost:9292/?profile=true ?

If you see a message like "No nodes to print" or "Running the command
'pprof.rb --text /tmp/rack_perftools_profiler.prof' failed to generate a
file"

it simply means that the code was so fast that it couldn't be profiled -
basically, the profiler never even had a chance to take a sample. This
usually only happens if the page is very simple (and therefore would not be
interesting to profile anyway). To get around this, I recommend inserting
some code like 5_000_000.times{ 1+2+3+4+5 } to artificially slow down the
route so you can see some profiling data.

Reply to this email directly or view it on GitHub:

#11 (comment)

from rack-perftools_profiler.

bhb avatar bhb commented on August 31, 2024

How strange. I'm running on OS X (10.6.8), so I'm not sure what the problem
is.

I checked out your branch on my machine and ran 'rackup -E profiling', and
hit http://localhost:9292/?profile=true and I get the error message "No
nodes to print".

Have you tried the basic example for perftools.rb on your machine? The
directions are in the README at https://github.com/tmm1/perftools.rb. Maybe
there is some error that my middleware is missing.

Can you also try this sequence?

http://localhost:9292/**start** (and see what message appears)
http://localhost:9292/
http://localhost:9292/**stop** (and see what message appears)
http://localhost:9292/**data** (and see what happens)

On Mon, Aug 15, 2011 at 2:38 PM, petewarden <
[email protected]>wrote:

Thanks Ben. I don't see any message in the logs, and the delivered page is
identical to the one served up without the profile argument.

It is helpful to know the application works for you though, since it
suggests the problem is with my machine's configuration, not the code. I'm
running it on my OS X laptop, so the next thing I'll try is a clean Ubuntu
EC2 box.

On Fri, Aug 12, 2011 at 2:25 PM, bhb <
[email protected]>wrote:

Strange. The code on my fork works for me. What do you see when you visit
http://localhost:9292/?profile=true ?

If you see a message like "No nodes to print" or "Running the command
'pprof.rb --text /tmp/rack_perftools_profiler.prof' failed to generate a
file"

it simply means that the code was so fast that it couldn't be profiled -
basically, the profiler never even had a chance to take a sample. This
usually only happens if the page is very simple (and therefore would not
be
interesting to profile anyway). To get around this, I recommend inserting
some code like 5_000_000.times{ 1+2+3+4+5 } to artificially slow down
the
route so you can see some profiling data.

Reply to this email directly or view it on GitHub:

#11 (comment)

Reply to this email directly or view it on GitHub:

#11 (comment)

Ben Brinckerhoff
bbrinck.com
twitter.com/bbrinck

from rack-perftools_profiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.