Apr-18-2017, 11:56 AM
Hello All,
I am trying to write a code that simulate write file stream with the control on speed throughput (40Mbit/s ,50Mbit/s etc ...) , and using different block size.
I have a basic code that can do full speed stream write , below example i calculating few parameters and the code
My question is that i can't figure out how to calculate sleep time between each write to achieve desired speed write?
Please advise
Thanks
I am trying to write a code that simulate write file stream with the control on speed throughput (40Mbit/s ,50Mbit/s etc ...) , and using different block size.
I have a basic code that can do full speed stream write , below example i calculating few parameters and the code
My question is that i can't figure out how to calculate sleep time between each write to achieve desired speed write?
Please advise
Thanks
Quote:40Mbit/s ==> 4.7683715820313 Mbyte/sec total 100Mbyte, block 128KB ==>0.125 Mbyte = 800IO's
4.7683715820313/0.125 = 38.1469726562504 frames per second
1000msec = 1 sec /38.1469726562504 frames = 26.21439999999973 Msec per frame write
blocksize = 128000 chunk = b'\xff'*blocksize with open("//10.0.0.25/Software/Testfile/file.file", "wb") as f: seq= 0 for num in range(1,800): f.write(chunk) f.seek(seq) seq = seq+blocksize ====> time.sleep(?)