The profiler module is a simple but effective mini-profiler for Play 1.2 and 1.3.
A demo is available (the complete source code is available at github)
This project is heavily inspired from mini-profiler and java implementation done by alvin’s java-mini-profiler and
The module logs the duration for the following:
- total request (routing included): time spent from
PlayPlugin.routeRequestto thePlayPlugin.afterInvocation - action: time spent in the controller action
The module logs the subsequent Ajax calls:
The module displays Play internal monitor statistics (querying Jamon data).
You may profile your own code using MiniProfiler class.
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); }
The profiler works with Google App Engine which hosts the demo
Add the module to your application:
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) :
<html>
<head>
...
${profiler.styles.raw()}
</head>
<body>
...
${profiler.scripts.raw()}
</body>
</html>A complete sample is available demonstrating the use of the module.
play deps
play build-moduleThe zip file is created in the dist folder.
Then open the zip file created in the dist/ folder and delete the following:
- the
samplefolder - the
eclipsefolder lib/appengine*.jar