Issue #2361 Added startup timing statements

Change-Id: I347b3e671ecd7c7c61b88e008e2d4c56d19e6108

Former-commit-id: 3f93aeeb8259600b1c6e0ff47641ff95337df605
This commit is contained in:
Nate Jensen 2013-10-15 14:23:59 -05:00
parent cd504e4e98
commit 323f594de4
4 changed files with 30 additions and 3 deletions

View file

@ -36,6 +36,7 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor;
import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.contexts.IContextService;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.application.ProgramArguments;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager; import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.ui.menus.DiscoverMenuContributions; import com.raytheon.uf.viz.ui.menus.DiscoverMenuContributions;
@ -55,6 +56,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* May 28, 2013 1967 njensen Remove unused subnode preferences * May 28, 2013 1967 njensen Remove unused subnode preferences
* Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without * Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without
* accessing UI thread. * accessing UI thread.
* Oct 15, 2013 2361 njensen Added startupTimer
* *
* </pre> * </pre>
* *
@ -67,6 +69,8 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
private boolean createdMenus = false; private boolean createdMenus = false;
protected ITimer startupTimer;
public VizWorkbenchAdvisor() { public VizWorkbenchAdvisor() {
detachedViewsListener = new CloseNonRestorableDetachedViewsListener(); detachedViewsListener = new CloseNonRestorableDetachedViewsListener();
} }
@ -316,6 +320,13 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
IContextService service = (IContextService) PlatformUI.getWorkbench() IContextService service = (IContextService) PlatformUI.getWorkbench()
.getService(IContextService.class); .getService(IContextService.class);
service.activateContext("com.raytheon.uf.viz.application.cave"); service.activateContext("com.raytheon.uf.viz.application.cave");
if (startupTimer != null) {
startupTimer.stop();
System.out.println("Workbench startup time: "
+ startupTimer.getElapsedTime() + " ms");
}
} }
/** /**
@ -326,4 +337,8 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
DiscoverMenuContributions.discoverContributions(); DiscoverMenuContributions.discoverContributions();
} }
public void setStartupTimer(ITimer startupTimer) {
this.startupTimer = startupTimer;
}
} }

View file

@ -75,6 +75,7 @@ public class Activator implements BundleActivator {
*/ */
@Override @Override
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
long t0 = System.currentTimeMillis();
if (this.isInstallOperation()) { if (this.isInstallOperation()) {
return; return;
} }
@ -90,6 +91,8 @@ public class Activator implements BundleActivator {
for (Bundle b : bundles) { for (Bundle b : bundles) {
createContext(bundleMap, contextMap, b, processing); createContext(bundleMap, contextMap, b, processing);
} }
System.out.println("Spring initialization: "
+ (System.currentTimeMillis() - t0) + " ms");
} }
private OSGIXmlApplicationContext createContext( private OSGIXmlApplicationContext createContext(

View file

@ -65,6 +65,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob; import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
import com.raytheon.uf.viz.core.status.VizStatusHandlerFactory; import com.raytheon.uf.viz.core.status.VizStatusHandlerFactory;
import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor;
import com.raytheon.viz.alerts.jobs.AutoUpdater; import com.raytheon.viz.alerts.jobs.AutoUpdater;
import com.raytheon.viz.alerts.jobs.MenuUpdater; import com.raytheon.viz.alerts.jobs.MenuUpdater;
import com.raytheon.viz.alerts.observers.ProductAlertObserver; import com.raytheon.viz.alerts.observers.ProductAlertObserver;
@ -97,6 +98,7 @@ import com.raytheon.viz.core.units.UnitRegistrar;
* Apr 23, 2013 #1939 randerso Allow serialization to complete initialization * Apr 23, 2013 #1939 randerso Allow serialization to complete initialization
* before connecting to JMS to avoid deadlock * before connecting to JMS to avoid deadlock
* May 23, 2013 #2005 njensen Shutdown on spring initialization errors * May 23, 2013 #2005 njensen Shutdown on spring initialization errors
* Oct 15, 2013 2361 njensen Added startupTimer
* *
* </pre> * </pre>
* *
@ -125,6 +127,9 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
@Override @Override
public final Object startComponent(String componentName) throws Exception { public final Object startComponent(String componentName) throws Exception {
ITimer startupTimer = TimeUtil.getTimer();
startupTimer.start();
// This is a workaround to receive status messages because without the // This is a workaround to receive status messages because without the
// PlatformUI initialized Eclipse throws out the status // PlatformUI initialized Eclipse throws out the status
// messages. Once PlatformUI has started, the status handler // messages. Once PlatformUI has started, the status handler
@ -243,11 +248,15 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
NotificationManagerJob.connect(); NotificationManagerJob.connect();
timer.stop(); timer.stop();
System.out.println("Initialization time: " + timer.getElapsedTime() System.out.println("Internal initialization time: "
+ "ms"); + timer.getElapsedTime() + " ms");
if (cave) { if (cave) {
workbenchAdvisor = getWorkbenchAdvisor(); workbenchAdvisor = getWorkbenchAdvisor();
if (workbenchAdvisor instanceof VizWorkbenchAdvisor) {
((VizWorkbenchAdvisor) workbenchAdvisor)
.setStartupTimer(startupTimer);
}
} else if (!nonui) { } else if (!nonui) {
workbenchAdvisor = new HiddenWorkbenchAdvisor(componentName, workbenchAdvisor = new HiddenWorkbenchAdvisor(componentName,
this); this);

View file

@ -27,7 +27,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* Record object for observations for Fog and Safeseas. * Fog, Safeseas, Snow Observation record
* *
* <pre> * <pre>
* *