diff options
author | slewis | 2015-08-04 20:45:58 +0000 |
---|---|---|
committer | slewis | 2015-08-04 20:45:58 +0000 |
commit | deadf47a0555767f285a2af630eed08f6e21274f (patch) | |
tree | c6c91ff51602994c5a90d9d0547806e62d582f5d /protocols/bundles/ch.ethz.iks.r_osgi.remote | |
parent | db6d57f6f677c55ed191bbb277cb37d5086207ab (diff) | |
download | org.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.tar.gz org.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.tar.xz org.eclipse.ecf-deadf47a0555767f285a2af630eed08f6e21274f.zip |
Added timing/tracing of sendMessage call in CnannelEndpointImpl.
Change-Id: I2edd46213a3b5cb1d37f3ccb0cc45d9b3510383f
Diffstat (limited to 'protocols/bundles/ch.ethz.iks.r_osgi.remote')
-rw-r--r-- | protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java index a9e5cfdbb..aede23476 100644 --- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java +++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java @@ -981,6 +981,24 @@ public final class ChannelEndpointImpl implements ChannelEndpoint { } } + private long startTime; + + public static final boolean TRACE_TIME = new Boolean(System.getProperty("ch.ethz.iks.r_osgi.traceSendMessageTime","false")).booleanValue(); + + void startTiming(String message) { + if (TRACE_TIME) { + startTime = System.currentTimeMillis(); + System.out.println("TIMING.START;"+(message==null?"":message)+";startTime="+startTime); + } + } + + void stopTiming(String message, Throwable exception) { + if (TRACE_TIME) { + System.out.println("TIMING.END;"+(message==null?"":message)+";duration="+(System.currentTimeMillis()-startTime)); + startTime = 0; + } + } + /** * send a message. * @@ -996,6 +1014,9 @@ public final class ChannelEndpointImpl implements ChannelEndpoint { msg.setXID(RemoteOSGiServiceImpl.nextXid()); } + Throwable t = null; + startTiming("sendMessage"); + try { try { networkChannel.sendMessage(msg); @@ -1014,11 +1035,15 @@ public final class ChannelEndpointImpl implements ChannelEndpoint { } } } catch (final NotSerializableException nse) { - throw new RemoteOSGiException("Error sending " + msg, nse); //$NON-NLS-1$ + t = new RemoteOSGiException("Error sending " + msg, nse); //$NON-NLS-1$ + throw ((RemoteOSGiException) t); } catch (final IOException ioe) { // failed to reconnect... dispose(); - throw new RemoteOSGiException("Network error", ioe); //$NON-NLS-1$ + t = new RemoteOSGiException("Network error", ioe); //$NON-NLS-1$ + throw ((RemoteOSGiException) t); + } finally { + stopTiming("sendMessage",t); } } |