README.textile
August 12, 2014 ยท View on GitHub
h1. profiler
The @profiler@ module is a simple but effective mini-profiler for @Play 1.2@ and @1.3@.
A demo is "available":http://play-profiler.appspot.com (the complete source code is available at "github":https://github.com/PerfectCarl/play-profiler-demo-gae)
!https://raw.githubusercontent.com/PerfectCarl/play-profiler/master/documentation/manual/profiler.PNG!
This project is heavily inspired from "mini-profiler":http://miniprofiler.com/ and java implementation done by alvin's "java-mini-profiler":https://github.com/alvins82/java-mini-profiler-core and
h2. Features
h3. Server side calls
The module logs the duration for the following:
- total request (routing included): time spent from @PlayPlugin.routeRequest@ to the @PlayPlugin.afterInvocation@
- action: time spent in the controller action
h3. Ajax calls
The module logs the subsequent Ajax calls:
h3. Play internal monitoring
The module displays Play internal monitor statistics (querying "Jamon":http://jamonapi.sourceforge.net/ data).
h3. Custom code profiling
You may profile your own code using @MiniProfiler@ class.
bc.. import play.modules.profiler.MiniProfiler; import play.modules.profiler.Step; ...
public static void custom() {
step = MiniProfiler.step("database", "DB calls");
List result;
try {
result = Data.findAll();
} finally {
step.close();
}
render(result);
}
h3. Supports Google App Engine
The profiler works with Google App Engine which hosts the "demo":http://play-profiler.appspot.com
h2. Getting started
Add the module to your application:
bc. require:
- play
- carl -> profiler 0.6.9.3
repositories:
- githubModules:
type: http
artifact: "https://github.com/PerfectCarl/play-[module]/raw/master/dist/[module]-[revision].zip"
contains:
- carl -> *
Then include the profiler's css and javascript resources in your root template file(likely @main.html@) :
bc.
...
{profiler.scripts.raw()}
h2. Sample application
A "complete sample":https://github.com/PerfectCarl/play-profiler/tree/master/sample is available demonstrating the use of the module.
h2. How to build
bc. play deps play build-module
The zip file is created in the @dist@ folder.
Then open the zip file created in the @dist/@ folder and delete the following:
- the @sample@ folder
- the @eclipse@ folder
- @lib/appengine*.jar@
h2. "Changelog":https://github.com/PerfectCarl/play-profiler/blob/master/CHANGELOG.textile