diff options
author | philwo <philwo@google.com> | 2018-07-11 06:35:29 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-11 06:36:32 -0700 |
commit | bb781f95a7837c628908b1737ab318f6d0e2dfe7 (patch) | |
tree | 82b4abd496d7930f4ffa4c447440603661178d3b /src/main | |
parent | 5ec54c91ff775cb50ac3b1b11ba0029a8c989359 (diff) |
Remove the "slow read" warning when using multi-threaded digesting.
Calculating the throughput of a digest operation and using it to assess whether
I/O is slow or not only makes sense when we're doing sequential I/O. With
parallel hashing, it's expected that individual operations are slow due to how
the scheduler works, but it doesn't mean that the overall progress is slow.
RELNOTES: None.
PiperOrigin-RevId: 204115311
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java index 37759f9ead..e45995cbcf 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java @@ -164,11 +164,17 @@ public class DigestUtils { long startTime = BlazeClock.nanoTime(); byte[] digest = path.getDigest(); - long millis = (BlazeClock.nanoTime() - startTime) / 1000000; - if (millis > SLOW_READ_MILLIS && (path.getFileSize() / millis) < SLOW_READ_THROUGHPUT) { - System.err.println("Slow read: a " + path.getFileSize() + "-byte read from " + path - + " took " + millis + "ms."); + // When using multi-threaded digesting, it makes no sense to use the throughput of a single + // digest operation to determine whether a read was abnormally slow (as the scheduler might just + // have preferred other reads). + if (!MULTI_THREADED_DIGEST.get()) { + long millis = (BlazeClock.nanoTime() - startTime) / 1000000; + if (millis > SLOW_READ_MILLIS && (path.getFileSize() / millis) < SLOW_READ_THROUGHPUT) { + System.err.printf( + "Slow read: a %d-byte read from %s took %d ms.%n", path.getFileSize(), path, millis); + } } + return digest; } |