You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jh...@apache.org on 2017/09/28 02:55:06 UTC
[15/50] [abbrv] hadoop git commit: HADOOP-14881. LoadGenerator should
use Time.monotonicNow() to measure durations. Contributed by Bharat
Viswanadham
HADOOP-14881. LoadGenerator should use Time.monotonicNow() to measure durations. Contributed by Bharat Viswanadham
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ac05a51b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ac05a51b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ac05a51b
Branch: refs/heads/YARN-5734
Commit: ac05a51bbb2a3fad4e85f9334a3408571967900a
Parents: e928ee5
Author: Jason Lowe <jl...@apache.org>
Authored: Mon Sep 25 15:35:44 2017 -0500
Committer: Jason Lowe <jl...@apache.org>
Committed: Mon Sep 25 15:35:44 2017 -0500
----------------------------------------------------------------------
.../hadoop/fs/loadGenerator/LoadGenerator.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ac05a51b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
index 6da5182..0bb1b46 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
@@ -277,9 +277,9 @@ public class LoadGenerator extends Configured implements Tool {
* the entire file */
private void read() throws IOException {
String fileName = files.get(r.nextInt(files.size()));
- long startTime = Time.now();
+ long startTimestamp = Time.monotonicNow();
InputStream in = fc.open(new Path(fileName));
- executionTime[OPEN] += (Time.now()-startTime);
+ executionTime[OPEN] += (Time.monotonicNow() - startTimestamp);
totalNumOfOps[OPEN]++;
while (in.read(buffer) != -1) {}
in.close();
@@ -299,9 +299,9 @@ public class LoadGenerator extends Configured implements Tool {
double fileSize = 0;
while ((fileSize = r.nextGaussian()+2)<=0) {}
genFile(file, (long)(fileSize*BLOCK_SIZE));
- long startTime = Time.now();
+ long startTimestamp = Time.monotonicNow();
fc.delete(file, true);
- executionTime[DELETE] += (Time.now()-startTime);
+ executionTime[DELETE] += (Time.monotonicNow() - startTimestamp);
totalNumOfOps[DELETE]++;
}
@@ -310,9 +310,9 @@ public class LoadGenerator extends Configured implements Tool {
*/
private void list() throws IOException {
String dirName = dirs.get(r.nextInt(dirs.size()));
- long startTime = Time.now();
+ long startTimestamp = Time.monotonicNow();
fc.listStatus(new Path(dirName));
- executionTime[LIST] += (Time.now()-startTime);
+ executionTime[LIST] += (Time.monotonicNow() - startTimestamp);
totalNumOfOps[LIST]++;
}
@@ -320,14 +320,14 @@ public class LoadGenerator extends Configured implements Tool {
* The file is filled with 'a'.
*/
private void genFile(Path file, long fileSize) throws IOException {
- long startTime = Time.now();
+ long startTimestamp = Time.monotonicNow();
FSDataOutputStream out = null;
try {
out = fc.create(file,
EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE),
CreateOpts.createParent(), CreateOpts.bufferSize(4096),
CreateOpts.repFac((short) 3));
- executionTime[CREATE] += (Time.now() - startTime);
+ executionTime[CREATE] += (Time.monotonicNow() - startTimestamp);
numOfOps[CREATE]++;
long i = fileSize;
@@ -337,8 +337,8 @@ public class LoadGenerator extends Configured implements Tool {
i -= s;
}
- startTime = Time.now();
- executionTime[WRITE_CLOSE] += (Time.now() - startTime);
+ startTimestamp = Time.monotonicNow();
+ executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTimestamp);
numOfOps[WRITE_CLOSE]++;
} finally {
IOUtils.cleanupWithLogger(LOG, out);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org