From b32a06c6f1b42c17e059b1a5da7069b0ca145996 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Nov 2010 15:30:40 +0100 Subject: [PATCH] Show template rendering time in milliseconds. --- src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java b/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java index 761e89b..a6373fc 100644 --- a/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java @@ -20,8 +20,11 @@ package net.pterodactylus.sone.web.page; import java.io.StringWriter; import java.util.Collection; import java.util.Collections; +import java.util.logging.Level; +import java.util.logging.Logger; import net.pterodactylus.sone.web.page.Page.Request.Method; +import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.template.Template; import freenet.clients.http.LinkEnabledCallback; import freenet.clients.http.PageMaker; @@ -36,6 +39,9 @@ import freenet.l10n.BaseL10n; */ public class TemplatePage implements Page, LinkEnabledCallback { + /** The logger. */ + private static final Logger logger = Logging.getLogger(TemplatePage.class); + /** The path of the page. */ private final String path; @@ -111,7 +117,10 @@ public class TemplatePage implements Page, LinkEnabledCallback { } try { + long start = System.nanoTime(); processTemplate(request, template); + long finish = System.nanoTime(); + logger.log(Level.FINEST, "Template was rendered in " + ((finish - start) / 1000) / 1000.0 + "ms."); } catch (RedirectException re1) { return new RedirectResponse(re1.getTarget()); } -- 2.7.4