Repository: flink Updated Branches: refs/heads/master 0e5a157ae -> d82fbf452
[hotfix] [network] Make time measurements with System.nanoTime() Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/908cf933 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/908cf933 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/908cf933 Branch: refs/heads/master Commit: 908cf9338d336e468a0c5528af46b25502a93a17 Parents: 0e5a157 Author: Stephan Ewen <[email protected]> Authored: Tue May 8 23:12:19 2018 +0200 Committer: Stephan Ewen <[email protected]> Committed: Sun May 13 13:41:24 2018 +0200 ---------------------------------------------------------------------- .../flink/runtime/io/network/netty/NettyClient.java | 12 ++++++------ .../flink/runtime/io/network/netty/NettyServer.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/908cf933/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyClient.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyClient.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyClient.java index 5fb083d..dd40190 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyClient.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyClient.java @@ -63,7 +63,7 @@ class NettyClient { this.protocol = protocol; - long start = System.currentTimeMillis(); + final long start = System.nanoTime(); bootstrap = new Bootstrap(); @@ -117,8 +117,8 @@ class NettyClient { throw new IOException("Failed to initialize SSL Context for the Netty client", e); } - long end = System.currentTimeMillis(); - LOG.info("Successful initialization (took {} ms).", (end - start)); + final long duration = (System.nanoTime() - start) / 1_000_000; + LOG.info("Successful initialization (took {} ms).", duration); } NettyConfig getConfig() { @@ -130,7 +130,7 @@ class NettyClient { } void shutdown() { - long start = System.currentTimeMillis(); + final long start = System.nanoTime(); if (bootstrap != null) { if (bootstrap.group() != null) { @@ -139,8 +139,8 @@ class NettyClient { bootstrap = null; } - long end = System.currentTimeMillis(); - LOG.info("Successful shutdown (took {} ms).", (end - start)); + final long duration = (System.nanoTime() - start) / 1_000_000; + LOG.info("Successful shutdown (took {} ms).", duration); } private void initNioBootstrap() { http://git-wip-us.apache.org/repos/asf/flink/blob/908cf933/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java index c6d09d0..81bc50d 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java @@ -73,7 +73,7 @@ class NettyServer { void init(final NettyProtocol protocol, NettyBufferPool nettyBufferPool) throws IOException { checkState(bootstrap == null, "Netty server has already been initialized."); - long start = System.currentTimeMillis(); + final long start = System.nanoTime(); bootstrap = new ServerBootstrap(); @@ -170,8 +170,8 @@ class NettyServer { localAddress = (InetSocketAddress) bindFuture.channel().localAddress(); - long end = System.currentTimeMillis(); - LOG.info("Successful initialization (took {} ms). Listening on SocketAddress {}.", (end - start), bindFuture.channel().localAddress().toString()); + final long duration = (System.nanoTime() - start) / 1_000_000; + LOG.info("Successful initialization (took {} ms). Listening on SocketAddress {}.", duration, localAddress); } NettyConfig getConfig() { @@ -187,7 +187,7 @@ class NettyServer { } void shutdown() { - long start = System.currentTimeMillis(); + final long start = System.nanoTime(); if (bindFuture != null) { bindFuture.channel().close().awaitUninterruptibly(); bindFuture = null; @@ -199,8 +199,8 @@ class NettyServer { } bootstrap = null; } - long end = System.currentTimeMillis(); - LOG.info("Successful shutdown (took {} ms).", (end - start)); + final long duration = (System.nanoTime() - start) / 1_000_000; + LOG.info("Successful shutdown (took {} ms).", duration); } private void initNioBootstrap() {
