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
1 2 3 4 5 6 7 8 9 10 11 12 |
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(?) |