3838LATENCY_PERCENTILES = [50 , 90 , 95 , 99 , 99.9 , 99.99 , 99.999 , 99.9999 , 99.99999 ]
3939SampleData = collections .namedtuple ('SampleData' , ['metric' , 'value' , 'unit' ])
4040
41- flags .DEFINE_integer (
41+ DISKSPD_PREFILL_DURATION = flags .DEFINE_integer (
4242 'diskspd_prefill_duration' ,
4343 None ,
4444 'In seconds. Diskspd needs a duration to run. For prefilling, use a'
@@ -283,32 +283,39 @@ def _GenerateDiskspdConfig(outstanding_io, threads):
283283 large_page_string = '-l' if FLAGS .diskspd_large_page else ''
284284 latency_stats_string = '-L' if FLAGS .diskspd_latency_stats else ''
285285 disable_affinity_string = '-n' if FLAGS .diskspd_disable_affinity else ''
286- software_cache_string = '-Su' if FLAGS .diskspd_software_cache else ''
287- write_through_string = '-Sw' if FLAGS .diskspd_write_through else ''
288286 access_pattern = FLAGS .diskspd_access_pattern
289287 diskspd_write_read_ratio = FLAGS .diskspd_write_read_ratio
290288 diskspd_block_size = FLAGS .diskspd_block_size
291- os_hint = access_pattern
292- if os_hint == 'si' :
293- os_hint = 's'
294289 if DISKSPD_STRIDE .value :
295290 access_pattern = (
296291 str (access_pattern )
297292 + DISKSPD_STRIDE .value
298293 )
299-
294+ cache_string = ''
295+ if FLAGS .diskspd_software_cache and FLAGS .diskspd_write_through :
296+ cache_string = '-Sh'
297+ elif FLAGS .diskspd_write_through :
298+ cache_string = '-Sw'
299+ elif FLAGS .diskspd_software_cache :
300+ cache_string = '-Su'
300301 throughput_per_ms_string = ''
301302 if FLAGS .diskspd_throughput_per_ms :
302303 throughput_per_ms_string = '-g' + str (FLAGS .diskspd_throughput_per_ms )
303304
305+ diskspd_file_size = ''
306+ if DISKSPD_PREFILL_DURATION .value is None :
307+ # -c in diskspd creates file. If prefill duration is set, we need to use the
308+ # already created file from the prefill stage.
309+ diskspd_file_size = f'-c{ FLAGS .diskspd_file_size } '
310+
304311 return (
305- f'-c { FLAGS . diskspd_file_size } -d{ FLAGS .diskspd_duration } '
312+ f'{ diskspd_file_size } -d{ FLAGS .diskspd_duration } '
306313 f' -t{ threads } -o{ outstanding_io } { latency_stats_string } -W{ FLAGS .diskspd_warmup } '
307314 f' -C{ FLAGS .diskspd_cooldown } -Rxml -w{ diskspd_write_read_ratio } '
308315 f' { large_page_string } { disable_affinity_string } '
309- f' { software_cache_string } { write_through_string } '
316+ f' { cache_string } '
310317 f' { throughput_per_ms_string } -b{ diskspd_block_size } '
311- f' -{ access_pattern } -f { os_hint } '
318+ f' -{ access_pattern } '
312319 f' F:\\ { DISKSPD_TMPFILE } > { DISKSPD_XMLFILE } '
313320 )
314321
@@ -430,8 +437,8 @@ def Prefill(running_vm):
430437 prefill_duration = FLAGS .diskspd_prefill_duration
431438 diskspd_exe_dir = ntpath .join (running_vm .temp_dir , 'x86' )
432439 diskspd_options = (
433- f'-c{ FLAGS .diskspd_file_size } -t16 -w100 -b4k -d{ prefill_duration } -Rxml'
434- f' -Sw -Su - o16 -r C:\\ scratch\\ { DISKSPD_TMPFILE } >'
440+ f'-c{ FLAGS .diskspd_file_size } -t16 -w100 -b64k -d{ prefill_duration } -Rxml'
441+ f' -Sh - o16 -Zr C:\\ scratch\\ { DISKSPD_TMPFILE } >'
435442 f' { DISKSPD_XMLFILE } '
436443 )
437444 command = f'cd { diskspd_exe_dir } ; .\\ diskspd.exe { diskspd_options } '
@@ -441,7 +448,7 @@ def Prefill(running_vm):
441448
442449 prefill_samples = ParseDiskSpdResults (result_xml , {})
443450 for prefill_sample in prefill_samples :
444- if prefill_sample .metric != 'write_throughput ' :
451+ if prefill_sample .metric != 'write_bandwidth ' :
445452 continue
446453 write_throughput = prefill_sample .value
447454 total_seconds = float (prefill_sample .metadata ['TestTimeSeconds' ])
0 commit comments