Permalink
Browse files

[389182] Suggestions for additional trace performance logging in

ServerBehaviourDelegate.publish
  • Loading branch information...
1 parent 7b4636b commit 7d8888162399a6a3ed1268a1505900c46841082b @elsony elsony committed Oct 29, 2012
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -920,11 +920,32 @@ public IStatus publish(int kind, IProgressMonitor monitor) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
+ /**
+ * Trace time for when publishing begins.
+ */
+ long publishStartTime = 0;
+ /**
+ * Trace time of the previous publishing action.
+ */
+ long previousPublishActionTime = publishStartTime;
+ if(Trace.PERFORMANCE) {
+ publishStartTime = System.currentTimeMillis();
+ previousPublishActionTime = publishStartTime;
+ }
try {
+ if(Trace.PERFORMANCE) {
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): start");
+ }
if (Trace.FINEST) {
Trace.trace(Trace.STRING_FINEST, "Starting publish");
}
publishStart(ProgressUtil.getSubMonitorFor(monitor, 1000));
+ long currentTime = 0;
+ if(Trace.PERFORMANCE) {
+ currentTime = System.currentTimeMillis();
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): publish start <" + (currentTime - previousPublishActionTime) + "> " + getServer().getServerType().getId());
+ previousPublishActionTime = currentTime;
+ }
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
@@ -937,6 +958,12 @@ public IStatus publish(int kind, IProgressMonitor monitor) {
// execute publishers
taskStatus = executePublishers(kind, moduleList, deltaKindList, monitor, info2);
+ if(Trace.PERFORMANCE) {
+ currentTime = System.currentTimeMillis();
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): run publishers <" + (currentTime - previousPublishActionTime) + "> " + getServer().getServerType().getId());
+ previousPublishActionTime = currentTime;
+ }
+
monitor.setTaskName(mainTaskMsg);
if (taskStatus != null && !taskStatus.isOK())
tempMulti.addAll(taskStatus);
@@ -947,12 +974,22 @@ public IStatus publish(int kind, IProgressMonitor monitor) {
// publish the server
publishServer(kind, ProgressUtil.getSubMonitorFor(monitor, 1000));
monitor.setTaskName(mainTaskMsg);
+ if(Trace.PERFORMANCE) {
+ currentTime = System.currentTimeMillis();
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): publisher server <" + (currentTime - previousPublishActionTime) + "> " + getServer().getServerType().getId());
+ previousPublishActionTime = currentTime;
+ }
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
// publish modules
publishModules(kind, moduleList, deltaKindList, tempMulti, monitor);
+ if(Trace.PERFORMANCE) {
+ currentTime = System.currentTimeMillis();
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): publish modules <" + (currentTime - previousPublishActionTime) + "> " + getServer().getServerType().getId());
+ previousPublishActionTime = currentTime;
+ }
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
@@ -972,6 +1009,11 @@ public IStatus publish(int kind, IProgressMonitor monitor) {
// end the publishing
try {
publishFinish(ProgressUtil.getSubMonitorFor(monitor, 500));
+ if(Trace.PERFORMANCE) {
+ long currentTime = System.currentTimeMillis();
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): publish finish <" + (currentTime - previousPublishActionTime) + "> " + getServer().getServerType().getId());
+ previousPublishActionTime = currentTime;
+ }
} catch (CoreException ce) {
if (Trace.INFO) {
Trace.trace(Trace.STRING_INFO, "CoreException publishing to " + toString(), ce);
@@ -983,6 +1025,9 @@ public IStatus publish(int kind, IProgressMonitor monitor) {
}
tempMulti.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, Messages.errorPublishing, e));
}
+ if(Trace.PERFORMANCE) {
+ Trace.trace(Trace.STRING_PERFORMANCE, "ServerBehaviourDelegate.publish(): <" + (previousPublishActionTime - publishStartTime) + "> " + getServer().getServerType().getId());
+ }
}
if (Trace.FINEST) {

0 comments on commit 7d88881

Please sign in to comment.