|
@@ -3942,6 +3942,7 @@ public abstract class FileSystem extends Configured
|
|
|
private volatile long bytesReadDistanceOfThreeOrFour;
|
|
|
private volatile long bytesReadDistanceOfFiveOrLarger;
|
|
|
private volatile long bytesReadErasureCoded;
|
|
|
+ private volatile long remoteReadTimeMS;
|
|
|
|
|
|
/**
|
|
|
* Add another StatisticsData object to this one.
|
|
@@ -3959,6 +3960,7 @@ public abstract class FileSystem extends Configured
|
|
|
this.bytesReadDistanceOfFiveOrLarger +=
|
|
|
other.bytesReadDistanceOfFiveOrLarger;
|
|
|
this.bytesReadErasureCoded += other.bytesReadErasureCoded;
|
|
|
+ this.remoteReadTimeMS += other.remoteReadTimeMS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3977,6 +3979,7 @@ public abstract class FileSystem extends Configured
|
|
|
this.bytesReadDistanceOfFiveOrLarger =
|
|
|
-this.bytesReadDistanceOfFiveOrLarger;
|
|
|
this.bytesReadErasureCoded = -this.bytesReadErasureCoded;
|
|
|
+ this.remoteReadTimeMS = -this.remoteReadTimeMS;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -4025,6 +4028,10 @@ public abstract class FileSystem extends Configured
|
|
|
public long getBytesReadErasureCoded() {
|
|
|
return bytesReadErasureCoded;
|
|
|
}
|
|
|
+
|
|
|
+ public long getRemoteReadTimeMS() {
|
|
|
+ return remoteReadTimeMS;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private interface StatisticsAggregator<T> {
|
|
@@ -4252,6 +4259,14 @@ public abstract class FileSystem extends Configured
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Increment the time taken to read bytes from remote in the statistics.
|
|
|
+ * @param durationMS time taken in ms to read bytes from remote
|
|
|
+ */
|
|
|
+ public void increaseRemoteReadTime(final long durationMS) {
|
|
|
+ getThreadStatistics().remoteReadTimeMS += durationMS;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Apply the given aggregator to all StatisticsData objects associated with
|
|
|
* this Statistics object.
|
|
@@ -4399,6 +4414,25 @@ public abstract class FileSystem extends Configured
|
|
|
return bytesRead;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Get total time taken in ms for bytes read from remote.
|
|
|
+ * @return time taken in ms for remote bytes read.
|
|
|
+ */
|
|
|
+ public long getRemoteReadTime() {
|
|
|
+ return visitAll(new StatisticsAggregator<Long>() {
|
|
|
+ private long remoteReadTimeMS = 0;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void accept(StatisticsData data) {
|
|
|
+ remoteReadTimeMS += data.remoteReadTimeMS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long aggregate() {
|
|
|
+ return remoteReadTimeMS;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get all statistics data.
|
|
|
* MR or other frameworks can use the method to get all statistics at once.
|