Skip to content

Commit 51467bb

Browse files
Arushi-07copybara-github
authored andcommitted
Use -Zr flag for diskspd prefill and using the file created by prefill in run.
PiperOrigin-RevId: 829118064
1 parent 524a7bf commit 51467bb

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

perfkitbenchmarker/windows_packages/diskspd.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
LATENCY_PERCENTILES = [50, 90, 95, 99, 99.9, 99.99, 99.999, 99.9999, 99.99999]
3939
SampleData = 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'])

tests/windows_packages/diskspd_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def testParseLatencyBucketInvalidPercentile(self):
154154
def testGenerateDiskspdConfig(self):
155155
config = diskspd._GenerateDiskspdConfig(outstanding_io=8, threads=4)
156156
expected_config = (
157-
'-c10G -d60 -t4 -o8 -L -W10 -C5 -Rxml -w70 -Su -Sw -b16K -r -fr'
157+
'-c10G -d60 -t4 -o8 -L -W10 -C5 -Rxml -w70 -Sh -b16K -r '
158158
f' F:\\{diskspd.DISKSPD_TMPFILE} > {diskspd.DISKSPD_XMLFILE}'
159159
)
160160
self.assertMultiLineEqual(config, expected_config)
@@ -169,7 +169,6 @@ def testGenerateDiskspdConfig(self):
169169
def testGenerateDiskspdConfigWithStride(self):
170170
config = diskspd._GenerateDiskspdConfig(outstanding_io=1, threads=1)
171171
self.assertIn('-s64K', config)
172-
self.assertIn('-fs', config)
173172

174173
@flagsaver.flagsaver(
175174
diskspd_latency_stats=False,

0 commit comments

Comments
 (0)