aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2018-02-05 09:07:24 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-05 09:10:03 -0800
commit5a48ecc2f2faf340a66a06fe67b0f200da8de9f3 (patch)
tree23b3eb6b4f49f020320746b4efbd024974c45ffe /src
parentf0d3715816ad775089769ee677fc4177f657596b (diff)
Pass ctime to the TimestampGranularityMonitor
We're now using ctime to detect file changes, so the timestamp granularity monitor should as well. Unfortunately, we currently get nanosecond ctime from Linux, but then only return millis from FileStatus, so this doesn't change the accuracy of the monitor at all. PiperOrigin-RevId: 184536539
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FileStateValue.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/util/io/TimestampGranularityMonitor.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java2
3 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FileStateValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/FileStateValue.java
index 7a3453a243..3d77021213 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FileStateValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FileStateValue.java
@@ -155,11 +155,10 @@ public abstract class FileStateValue implements SkyValue {
try {
byte[] digest = tryGetDigest(path, stat);
if (digest == null) {
- long mtime = stat.getLastModifiedTime();
// Note that TimestampGranularityMonitor#notifyDependenceOnFileTime is a thread-safe
// method.
if (tsgm != null) {
- tsgm.notifyDependenceOnFileTime(path.asFragment(), mtime);
+ tsgm.notifyDependenceOnFileTime(path.asFragment(), stat.getLastChangeTime());
}
return new RegularFileStateValue(stat.getSize(), null, FileContentsProxy.create(stat));
} else {
@@ -256,10 +255,9 @@ public abstract class FileStateValue implements SkyValue {
static SpecialFileStateValue fromStat(PathFragment path, FileStatus stat,
@Nullable TimestampGranularityMonitor tsgm) throws IOException {
- long mtime = stat.getLastModifiedTime();
// Note that TimestampGranularityMonitor#notifyDependenceOnFileTime is a thread-safe method.
if (tsgm != null) {
- tsgm.notifyDependenceOnFileTime(path, mtime);
+ tsgm.notifyDependenceOnFileTime(path, stat.getLastChangeTime());
}
return new SpecialFileStateValue(FileContentsProxy.create(stat));
}
diff --git a/src/main/java/com/google/devtools/build/lib/util/io/TimestampGranularityMonitor.java b/src/main/java/com/google/devtools/build/lib/util/io/TimestampGranularityMonitor.java
index 215e74bbd5..dee3fb6ee7 100644
--- a/src/main/java/com/google/devtools/build/lib/util/io/TimestampGranularityMonitor.java
+++ b/src/main/java/com/google/devtools/build/lib/util/io/TimestampGranularityMonitor.java
@@ -125,12 +125,12 @@ public class TimestampGranularityMonitor {
* of a build file or source file with the specified time stamp.
*/
@ThreadSafe
- public void notifyDependenceOnFileTime(PathFragment path, long mtime) {
- if (mtime == this.commandStartTimeMillis) {
+ public void notifyDependenceOnFileTime(PathFragment path, long ctimeMillis) {
+ if (ctimeMillis == this.commandStartTimeMillis) {
logger.info("Will have to wait for a millisecond on completion because of " + path);
this.waitAMillisecond = true;
}
- if (mtime == this.commandStartTimeMillisRounded) {
+ if (ctimeMillis == this.commandStartTimeMillisRounded) {
logger.info("Will have to wait for a second on completion because of " + path);
this.waitASecond = true;
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java
index cd5b31768f..b03a0e9eae 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ParallelBuilderTest.java
@@ -283,7 +283,7 @@ public class ParallelBuilderTest extends TimestampBuilderTestCase {
@Override
public long getLastChangeTime() throws IOException {
- return original.getLastChangeTime();
+ throw new IOException();
}
};
}