Comments (8)
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.
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 thisrackup -E profiling
or, you can alter the code in your app to be like this:
configure do use ::Rack::PerftoolsProfiler, :default_printer => 'gif' endand 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:
from rack-perftools_profiler.
"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
thisrackup -E profiling
or, you can alter the code in your app to be like this:
configure do use ::Rack::PerftoolsProfiler, :default_printer => 'gif' endand 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:
Reply to this email directly or view it on GitHub:
Ben Brinckerhoff
bbrinck.com
twitter.com/bbrinck
from rack-perftools_profiler.
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.
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=trueI hope that helps. Let me know if you have any other questions.
Ben
Reply to this email directly or view it on GitHub:
from rack-perftools_profiler.
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.
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 like5_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:
from rack-perftools_profiler.
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 like5_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:
Reply to this email directly or view it on GitHub:
Ben Brinckerhoff
bbrinck.com
twitter.com/bbrinck
from rack-perftools_profiler.
Related Issues (20)
- get some segfaults with __data__ in :walltime HOT 3
- In rails, when adding the profile attribute to a form in rails for the option of profiling nested param structures are degraded into strings HOT 1
- routes problem with devise default setup HOT 4
- Segmentation fault when using :mode => :objects HOT 2
- Unable to provide :password => "password" and then not profile requests HOT 2
- Unable to get useful profiling data HOT 3
- Symbol not found: _ruby_current_thread HOT 6
- Update perftools.rb dependency to allow 2.0.0 HOT 3
- Enabling/disabling GC manually causes rack-perftools_profiler to hang HOT 1
- Objects mode not collecting data? HOT 3
- Install fails on Windows due to missing tar command HOT 2
- crash in rb_stack_trace on ruby-1.9.3-p286 HOT 1
- quickstart instructions don't work, need 'gem install perftools.rb'
- Broken on Ruby 2: Bump the perftools.rb dependency for fix HOT 2
- Installation fails for ruby 2.1 HOT 3
- ?profile=true causes error when using mode: objects HOT 4
- no ps2pdf package for Ubuntu, should use ghostscript HOT 1
- Segment fault when trying to stop profiler by visiting /__stop__ on Rails 4.0.5 / Ruby 2.1.1 HOT 1
- Perl errors when trying to use tool, Mac OS Yosemite and Ruby 2.0.0-p247 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rack-perftools_profiler.