diff options
author | Alex Blewitt | 2015-08-19 18:36:22 +0000 |
---|---|---|
committer | Alex Blewitt | 2015-08-31 08:51:39 +0000 |
commit | 04d970f72e421446cac0947b1f81898b16e04ac2 (patch) | |
tree | b2feb1e4a93f20837388600c0296ec59834a3e66 | |
parent | e06dc5f8aa8f053673af0aa29c5b517addc9af65 (diff) | |
download | rt.equinox.framework-04d970f72e421446cac0947b1f81898b16e04ac2.tar.gz rt.equinox.framework-04d970f72e421446cac0947b1f81898b16e04ac2.tar.xz rt.equinox.framework-04d970f72e421446cac0947b1f81898b16e04ac2.zip |
Bug 475416 - Add timing information to BundleLoader
When debugging slow start times, much of the slowness can be
attributed to classes that are slow to be defined, typically
due to dependencies on other bundles' activators being executed.
By calculating the time taken, hot spots can be identified
and resolved.
Timing information is only displayed if the debug option
debug/loader is enabled.
Bug: 475416
Change-Id: I5605fa2c2eb82d0b79d1af086d9e0a8bd69d5867
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java index 20ed6e700..5fcfed8d1 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 IBM Corporation and others. + * Copyright (c) 2004, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -321,12 +321,17 @@ public class BundleLoader extends ModuleLoader { * @throws ClassNotFoundException */ public Class<?> findLocalClass(String name) throws ClassNotFoundException { - if (debug.DEBUG_LOADER) + long start = 0; + if (debug.DEBUG_LOADER) { Debug.println("BundleLoader[" + this + "].findLocalClass(" + name + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + start = System.currentTimeMillis(); + } try { Class<?> clazz = getModuleClassLoader().findLocalClass(name); - if (debug.DEBUG_LOADER && clazz != null) - Debug.println("BundleLoader[" + this + "] found local class " + name); //$NON-NLS-1$ //$NON-NLS-2$ + if (debug.DEBUG_LOADER && clazz != null) { + long time = System.currentTimeMillis() - start; + Debug.println("BundleLoader[" + this + "] found local class " + name + " " + time + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } return clazz; } catch (ClassNotFoundException e) { if (e.getCause() instanceof BundleException) { |