From 3ce58db65862305a379327dd5c47b9e14bcc5b89 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 16 Nov 2015 12:24:36 +0100 Subject: [PATCH] save timing debug log --- .../src/ComponentStoreImpl.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 8e0294ddc158..07b7e8fe2cd7 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -117,8 +117,21 @@ abstract class ComponentStoreImpl : IComponentStore { if (externalizationSession != null) { val names = ArrayUtilRt.toStringArray(components.keys) Arrays.sort(names) + val timeLogPrefix = "Saving" + var timeLog = if (LOG.isDebugEnabled) StringBuilder(timeLogPrefix) else null for (name in names) { + val start = if (timeLog == null) 0 else System.currentTimeMillis() commitComponent(externalizationSession, components.get(name)!!, name) + timeLog?.let { + val duration = System.currentTimeMillis() - start + if (duration > 10) { + it.append("\n").append(name).append(" took ").append(duration).append(" ms: ").append((duration / 60000)).append(" min ").append(((duration % 60000) / 1000)).append("sec") + } + } + } + + if (timeLog != null && timeLog.length > timeLogPrefix.length) { + LOG.debug(timeLog.toString()) } } -- 2.32.0