Skip to content

Commit 3c998c6

Browse files
authored
Merge pull request #55 from redhat-performance/output_formatting
Switch to group reporting and adapt data reduction
2 parents fc644a1 + bf79a0e commit 3c998c6

1 file changed

Lines changed: 38 additions & 54 deletions

File tree

fio/fio_run

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -245,54 +245,25 @@ report_info()
245245
}
246246

247247
#
248-
# Averaging function for json formatted bw and iops
248+
# Summing function for json formatted bw and iops
249249
#
250-
obtain_avg()
250+
obtain_val()
251251
{
252-
FIELD=${1}
253-
value=`jq '.. | select(type == "object" and has('\"$FIELD\"')).'\"$FIELD\"'' fio-results.json`
254-
nitems=0
255-
calc="scale=2;("
256-
field_separ=""
257-
for val in $value; do
258-
calc="${calc}${field_separ}$val"
259-
let "nitems=$nitems+1"
260-
field_separ="+"
261-
done
262-
if [ ${nitems} -eq 0 ]; then
263-
calc=0
264-
else
265-
# Divide by 3 since the json output includes all three I/O types and we only care about one
266-
calc="${calc})/(${nitems}/3)"
267-
fi
268-
rtval=`echo $calc | bc`
269-
echo $rtval
252+
FIELD=${1}
253+
value=`jq '.. | select(type == "object" and has('\"$FIELD\"')).'\"$FIELD\"'' fio-results.json | grep -w -v 0.000000`
254+
echo ${value}
270255
}
271256

272257
#
273258
# A latency-specific averaging function to handle how the json output is formatted for clat, lat, and slat
274259
#
275260
obtain_avg_lat()
276261
{
277-
FIELD=${1}
278-
value=`jq '.. | select(type == "object" and has('\"$FIELD\"')).'\"$FIELD\"'.mean' fio-results.json`
279-
nitems=0
280-
calc="scale=2;("
281-
field_separ=""
282-
for val in $value; do
283-
calc="${calc}${field_separ}$val"
284-
let "nitems=$nitems+1"
285-
field_separ="+"
286-
done
287-
if [ ${nitems} -eq 0 ]; then
288-
calc=0
289-
else
290-
# Divide by 3 since the json output includes all three I/O types and we only care about one
291-
# Divide by 1000 because the json output is nsec but usec is a bit more friendly for now
292-
calc="${calc})/(${nitems}/3)/1000"
293-
fi
294-
rtval=`echo $calc | bc`
295-
echo $rtval
262+
FIELD=${1}
263+
value=`jq '.. | select(type == "object" and has('\"$FIELD\"')).'\"$FIELD\"'.mean' fio-results.json | grep -w -v 0.000000`
264+
calc="${value}/1000" # ns is a little cumbersome for now, use us
265+
rtval=`echo ${calc} | bc`
266+
echo ${rtval}
296267
}
297268

298269

@@ -326,11 +297,11 @@ reduce_data()
326297
if [ -d "$dir" ]; then
327298
fname=`echo $dir | cut -d'-' -f 2-30`
328299
cd $dir
329-
bw=$(obtain_avg "bw_mean")
330-
iops=$(obtain_avg "iops")
300+
bw=$(obtain_val "bw_mean")
301+
iops=$(obtain_val "iops")
331302
clat=$(obtain_avg_lat "clat_ns")
332-
slat=$(obtain_avg_lat "slat_ns")
333-
lat=$(obtain_avg_lat "lat_ns")
303+
slat=$(obtain_avg_lat "slat_ns")
304+
lat=$(obtain_avg_lat "lat_ns")
334305
echo "${njobs}:${ndisks}:${iodepth}:${bw}" >> $rdir/results_${fname}/results_bw.csv
335306
echo "${njobs}:${ndisks}:${iodepth}:${iops}" >> $rdir/results_${fname}/results_iops.csv
336307
echo "${njobs}:${ndisks}:${iodepth}:${slat}" >> $rdir/results_${fname}/results_slat.csv
@@ -346,41 +317,54 @@ reduce_data()
346317
#
347318
# Now sort the results csv files and place headers
348319
#
349-
$TOOLS_BIN/test_header_info --front_matter --results_file $working_dir/results_fio.csv --host $to_configuration --sys_type $to_sys_type --tuned $to_tuned_setting --results_version $results_version --test_name $test_name
320+
$TOOLS_BIN/test_header_info --test_name ${test_name} --info_in_dir_name "$file 2,3 4,5,6 9,10" --results_file ${working_dir}/results_fio.csv
350321
for list in `ls -d results_*`; do
351322
pushd $list > /dev/null
352323
op_and_size=`echo $list | cut -d'_' -f 2`
353324
op=`echo "$op_and_size" | cut -d'-' -f1`
354325
size=`echo "$op_and_size" | cut -d'-' -f2`
355326
for ifile in `ls res*`; do
356-
$TOOLS_BIN/test_header_info --test_name ${test_name} --info_in_dir_name "$file 2,3 4,5,6 7,8 9,10" --meta_output "op: $op" --meta_output "size: $size" --results_file results.csv
327+
# Sort the metrics
357328
if [[ $ifile == *"bw"* ]]; then
358-
echo "njobs:ndisks:iodepth:bw" >> results.csv
329+
sort -t : -k 3 -n $ifile >> tmp_bw.csv
359330
fi
360331
if [[ $ifile == *"iops"* ]]; then
361-
echo "njobs:ndisks:iodepth:iops" >> results.csv
332+
sort -t : -k 3 -n $ifile | cut -d : -f 4 >> tmp_iops.csv
362333
fi
363334
if [[ $ifile == *"_lat"* ]]; then
364-
echo "njobs:ndisks:iodepth:lat" >> results.csv
335+
sort -t : -k 3 -n $ifile | cut -d : -f 4 >> tmp_lat.csv
365336
fi
366337
if [[ $ifile == *"_clat"* ]]; then
367-
echo "njobs:ndisks:iodepth:clat" >> results.csv
338+
sort -t : -k 3 -n $ifile | cut -d : -f 4 >> tmp_clat.csv
368339
fi
369340
if [[ $ifile == *"_slat"* ]]; then
370-
echo "njobs:ndisks:iodepth:slat" >> results.csv
341+
sort -t : -k 3 -n $ifile | cut -d : -f 4 >> tmp_slat.csv
371342
fi
372-
sort -t : -k 3 -n $ifile >> results.csv
373-
echo "" >> results.csv
343+
done
344+
# Stage the op & size fields, one line for each line of results
345+
num_lines=`wc -l tmp_bw.csv | awk {'print $1'}`
346+
for ct in `seq 1 ${num_lines}`; do
347+
echo "${op}:${size}" | sed 's/...$//' >> tmp_ons.csv
348+
done
349+
350+
# Now merge them together with colons as separators
351+
pr -m -T -s: tmp_ons.csv tmp_bw.csv tmp_iops.csv tmp_clat.csv tmp_lat.csv tmp_slat.csv >> results.csv
374352

375353
cat results.csv >> $working_dir/results_fio.csv
354+
355+
# Clean up after ourselves
376356
rm results.csv
377-
done
357+
rm tmp_*.csv
358+
378359
popd > /dev/null
379360
done
380361
}
381362

382363
reduce_io_data()
383364
{
365+
$TOOLS_BIN/test_header_info --front_matter --results_file $working_dir/results_fio.csv --host $to_configuration --sys_type $to_sys_type --tuned $to_tuned_setting --results_version $results_version --test_name $test_name
366+
echo "op:blocksize_KiB:njobs:ndisks:iodepth:bw_KiB_s:iops:clat_us:lat_us:slat_us" >> ${working_dir}/results_fio.csv
367+
384368
aio_type=`ls -d fio* | cut -d'_' -f 10 | sort -u`
385369

386370
#
@@ -651,7 +635,7 @@ loop_io_tests()
651635
build_run_file $ios $ioe $iodepth $njobs $run_time $disk_list $io_test
652636
cp /tmp/fio_run ${out_dir}/file_run_${test_index}
653637
let "test_index=${test_index}+1"
654-
fio --output-format=json /tmp/fio_run >> $rdir/fio-results.json
638+
fio --output-format=json --group_reporting /tmp/fio_run >> $rdir/fio-results.json
655639
mv *.log $rdir # preserve raw data
656640
lines=`wc -l $rdir/fio-results.json | cut -d' ' -f 1`
657641
if [ $lines -lt 2 ]; then

0 commit comments

Comments
 (0)