From: Mathieu Baudier Date: Mon, 26 Jan 2015 11:10:17 +0000 (+0000) Subject: Directors cut X-Git-Tag: argeo-commons-2.1.30~436 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=ea6fee548234d440510be4d67ea26dc36646f97a;p=lgpl%2Fargeo-commons.git Directors cut git-svn-id: https://svn.argeo.org/commons/trunk@7699 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java index c6a1630ae..95c76a0a0 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java @@ -61,6 +61,7 @@ final class Kernel { long duration = System.currentTimeMillis() - begin; log.info("## ARGEO CMS UP in " + (duration / 1000) + "." + (duration % 1000) + "s ##"); + directorsCut(); } void destroy() { @@ -75,4 +76,22 @@ final class Kernel { + (duration % 1000) + "s ##"); } + private void directorsCut() { + final long ms = 128l + (long) (Math.random() * 128d); + log.info("Spend " + ms + "ms" + + " reflecting on the progress brought to mankind" + + " by Free Software..."); + long beginNano = System.nanoTime(); + try { + Thread.sleep(ms, 0); + } catch (InterruptedException e) { + // silent + } + long durationNano = System.nanoTime() - beginNano; + final double M = 1000d * 1000d; + double sleepAccuracy = ((double) durationNano) / (ms * M); + log.debug("Sleep accuracy: " + + String.format("%.2f", sleepAccuracy * 100) + " %"); + } + }