@@ -228,67 +228,53 @@ public static void afterClass() throws Exception {
228
228
229
229
public static void testWrite () throws Exception {
230
230
FileSystem fs = cluster .getFileSystem ();
231
- long tStart = System .currentTimeMillis ();
232
- bench .writeTest (fs );
233
- long execTime = System .currentTimeMillis () - tStart ;
231
+ long execTime = bench .writeTest (fs );
234
232
bench .analyzeResult (fs , TestType .TEST_TYPE_WRITE , execTime );
235
233
}
236
234
237
235
@ Test (timeout = 10000 )
238
236
public void testRead () throws Exception {
239
237
FileSystem fs = cluster .getFileSystem ();
240
- long tStart = System .currentTimeMillis ();
241
- bench .readTest (fs );
242
- long execTime = System .currentTimeMillis () - tStart ;
238
+ long execTime = bench .readTest (fs );
243
239
bench .analyzeResult (fs , TestType .TEST_TYPE_READ , execTime );
244
240
}
245
241
246
242
@ Test (timeout = 10000 )
247
243
public void testReadRandom () throws Exception {
248
244
FileSystem fs = cluster .getFileSystem ();
249
- long tStart = System .currentTimeMillis ();
250
245
bench .getConf ().setLong ("test.io.skip.size" , 0 );
251
- bench .randomReadTest (fs );
252
- long execTime = System .currentTimeMillis () - tStart ;
246
+ long execTime = bench .randomReadTest (fs );
253
247
bench .analyzeResult (fs , TestType .TEST_TYPE_READ_RANDOM , execTime );
254
248
}
255
249
256
250
@ Test (timeout = 10000 )
257
251
public void testReadBackward () throws Exception {
258
252
FileSystem fs = cluster .getFileSystem ();
259
- long tStart = System .currentTimeMillis ();
260
253
bench .getConf ().setLong ("test.io.skip.size" , -DEFAULT_BUFFER_SIZE );
261
- bench .randomReadTest (fs );
262
- long execTime = System .currentTimeMillis () - tStart ;
254
+ long execTime = bench .randomReadTest (fs );
263
255
bench .analyzeResult (fs , TestType .TEST_TYPE_READ_BACKWARD , execTime );
264
256
}
265
257
266
258
@ Test (timeout = 10000 )
267
259
public void testReadSkip () throws Exception {
268
260
FileSystem fs = cluster .getFileSystem ();
269
- long tStart = System .currentTimeMillis ();
270
261
bench .getConf ().setLong ("test.io.skip.size" , 1 );
271
- bench .randomReadTest (fs );
272
- long execTime = System .currentTimeMillis () - tStart ;
262
+ long execTime = bench .randomReadTest (fs );
273
263
bench .analyzeResult (fs , TestType .TEST_TYPE_READ_SKIP , execTime );
274
264
}
275
265
276
266
@ Test (timeout = 10000 )
277
267
public void testAppend () throws Exception {
278
268
FileSystem fs = cluster .getFileSystem ();
279
- long tStart = System .currentTimeMillis ();
280
- bench .appendTest (fs );
281
- long execTime = System .currentTimeMillis () - tStart ;
269
+ long execTime = bench .appendTest (fs );
282
270
bench .analyzeResult (fs , TestType .TEST_TYPE_APPEND , execTime );
283
271
}
284
272
285
273
@ Test (timeout = 60000 )
286
274
public void testTruncate () throws Exception {
287
275
FileSystem fs = cluster .getFileSystem ();
288
276
bench .createControlFile (fs , DEFAULT_NR_BYTES / 2 , DEFAULT_NR_FILES );
289
- long tStart = System .currentTimeMillis ();
290
- bench .truncateTest (fs );
291
- long execTime = System .currentTimeMillis () - tStart ;
277
+ long execTime = bench .truncateTest (fs );
292
278
bench .analyzeResult (fs , TestType .TEST_TYPE_TRUNCATE , execTime );
293
279
}
294
280
@@ -430,12 +416,14 @@ public Long doIO(Reporter reporter,
430
416
}
431
417
}
432
418
433
- private void writeTest (FileSystem fs ) throws IOException {
419
+ private long writeTest (FileSystem fs ) throws IOException {
434
420
Path writeDir = getWriteDir (config );
435
421
fs .delete (getDataDir (config ), true );
436
422
fs .delete (writeDir , true );
437
-
423
+ long tStart = System . currentTimeMillis ();
438
424
runIOTest (WriteMapper .class , writeDir );
425
+ long execTime = System .currentTimeMillis () - tStart ;
426
+ return execTime ;
439
427
}
440
428
441
429
private void runIOTest (
@@ -496,10 +484,13 @@ public Long doIO(Reporter reporter,
496
484
}
497
485
}
498
486
499
- private void appendTest (FileSystem fs ) throws IOException {
487
+ private long appendTest (FileSystem fs ) throws IOException {
500
488
Path appendDir = getAppendDir (config );
501
489
fs .delete (appendDir , true );
490
+ long tStart = System .currentTimeMillis ();
502
491
runIOTest (AppendMapper .class , appendDir );
492
+ long execTime = System .currentTimeMillis () - tStart ;
493
+ return execTime ;
503
494
}
504
495
505
496
/**
@@ -539,10 +530,13 @@ public Long doIO(Reporter reporter,
539
530
}
540
531
}
541
532
542
- private void readTest (FileSystem fs ) throws IOException {
533
+ private long readTest (FileSystem fs ) throws IOException {
543
534
Path readDir = getReadDir (config );
544
535
fs .delete (readDir , true );
536
+ long tStart = System .currentTimeMillis ();
545
537
runIOTest (ReadMapper .class , readDir );
538
+ long execTime = System .currentTimeMillis () - tStart ;
539
+ return execTime ;
546
540
}
547
541
548
542
/**
@@ -620,10 +614,13 @@ private long nextOffset(long current) {
620
614
}
621
615
}
622
616
623
- private void randomReadTest (FileSystem fs ) throws IOException {
617
+ private long randomReadTest (FileSystem fs ) throws IOException {
624
618
Path readDir = getRandomReadDir (config );
625
619
fs .delete (readDir , true );
620
+ long tStart = System .currentTimeMillis ();
626
621
runIOTest (RandomReadMapper .class , readDir );
622
+ long execTime = System .currentTimeMillis () - tStart ;
623
+ return execTime ;
627
624
}
628
625
629
626
/**
@@ -665,10 +662,13 @@ public Long doIO(Reporter reporter,
665
662
}
666
663
}
667
664
668
- private void truncateTest (FileSystem fs ) throws IOException {
665
+ private long truncateTest (FileSystem fs ) throws IOException {
669
666
Path TruncateDir = getTruncateDir (config );
670
667
fs .delete (TruncateDir , true );
668
+ long tStart = System .currentTimeMillis ();
671
669
runIOTest (TruncateMapper .class , TruncateDir );
670
+ long execTime = System .currentTimeMillis () - tStart ;
671
+ return execTime ;
672
672
}
673
673
674
674
private void sequentialTest (FileSystem fs ,
0 commit comments