Skip to content

Commit

Permalink
Log the time taken for generating the initialSeedUniquifier
Browse files Browse the repository at this point in the history
- Sometimes useful to know it how long it takes from the log, to make
  sure it's not something else that is blocking.
  • Loading branch information
trustin committed Jul 4, 2014
1 parent 13a0a36 commit b4c2ae5
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -156,6 +156,7 @@ public void uncaughtException(Thread t, Throwable e) {
}

private static long newSeed() {
final long startTime = System.nanoTime();
for (;;) {
final long current = seedUniquifier.get();
final long actualCurrent = current != 0? current : getInitialSeedUniquifier();
Expand All @@ -165,7 +166,9 @@ private static long newSeed() {

if (seedUniquifier.compareAndSet(current, next)) {
if (current == 0 && logger.isDebugEnabled()) {
logger.debug(String.format("-Dio.netty.initialSeedUniquifier: 0x%016x", actualCurrent));
logger.debug(String.format(
"-Dio.netty.initialSeedUniquifier: 0x%016x (took %d ms)",
actualCurrent, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)));
}
return next ^ System.nanoTime();
}
Expand Down

0 comments on commit b4c2ae5

Please sign in to comment.