HDFS-9153. Pretty-format the output for DFSIO. Contributed by Kai Zheng.

This commit is contained in:
Haohui Mai 2015-11-22 16:18:07 -08:00
parent 0c7340f377
commit 000e12f6fa
2 changed files with 15 additions and 10 deletions

View File

@ -1668,6 +1668,8 @@ Release 2.8.0 - UNRELEASED
HDFS-9402. Switch DataNode.LOG to use slf4j. (Walter Su via wheat9) HDFS-9402. Switch DataNode.LOG to use slf4j. (Walter Su via wheat9)
HDFS-9153. Pretty-format the output for DFSIO. (Kai Zheng via wheat9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -28,6 +28,7 @@
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.text.DecimalFormat;
import java.util.Date; import java.util.Date;
import java.util.Random; import java.util.Random;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -901,19 +902,21 @@ else if (attr.endsWith(":sqrate"))
if(in != null) in.close(); if(in != null) in.close();
if(lines != null) lines.close(); if(lines != null) lines.close();
} }
double med = rate / 1000 / tasks; double med = rate / 1000 / tasks;
double stdDev = Math.sqrt(Math.abs(sqrate / 1000 / tasks - med*med)); double stdDev = Math.sqrt(Math.abs(sqrate / 1000 / tasks - med*med));
DecimalFormat df = new DecimalFormat("#.##");
String resultLines[] = { String resultLines[] = {
"----- TestDFSIO ----- : " + testType, "----- TestDFSIO ----- : " + testType,
" Date & time: " + new Date(System.currentTimeMillis()), " Date & time: " + new Date(System.currentTimeMillis()),
" Number of files: " + tasks, " Number of files: " + tasks,
"Total MBytes processed: " + toMB(size), " Total MBytes processed: " + df.format(toMB(size)),
" Throughput mb/sec: " + size * 1000.0 / (time * MEGA), " Throughput mb/sec: " + df.format(size * 1000.0 / (time * MEGA)),
"Average IO rate mb/sec: " + med, "Total Throughput mb/sec: " + df.format(toMB(size) / ((float)execTime)),
" IO rate std deviation: " + stdDev, " Average IO rate mb/sec: " + df.format(med),
" Test exec time sec: " + (float)execTime / 1000, " IO rate std deviation: " + df.format(stdDev),
"" }; " Test exec time sec: " + df.format((float)execTime / 1000),
"" };
PrintStream res = null; PrintStream res = null;
try { try {