is there a profiling gem/plugin for Ruby on Rails?
That is, where I can then specify the point in a request I want to act
as milestones points for a time to be taken, and place them
strategically. Then ideally the plugin then works out and displays how
the overall response time was made up...
Not sure if it exactly matches your requirements, but it's quite
powerful.
You can setup the start/stop points in your code, then run the request
and have it spit out the results into a file. You can set whether it's
profiling wall-time or processer-cycles or even (I think) memory
usage.
You can even generate valgrind-style files that can be displayed in
programs like kcachegrind to easily visualise where the program's
spending its time.
So the type of thing I was after was the ability to say:
* define checkpoints in code for the profile, but with some indication
of hierachy for later reporting, e.g.
- profile_point(:start, "main")
- profile_point(:start, "validations")
- profile_point(:start, "validation 1")
- profile_point(:end, "validation 1") # options ends
- profile_point(:start, "validation 2")
- profile_point(:end, "validation 2") # options ends
- profile_point(:start, "database stuff")
- profile_point(:end, "database stuff")
- profile_point(:end, "main")
* so then you can get timings for each, e.g.
main=30sec [xx%]
validations=20sec [xx%]
validation1=5sec [xx%]
validation2=15sec [xx%]
database_stuff = 10 sec [xx%]
So this type of thing.
Probably not much work to do, but I was wondering if there was a
library that let you customize the timing points you wanted to
profile. Another valid add would be getting averages for these values
over mulitiple calls.
Any existing gems/plugins/libraries that would do this?