dimanche 18 février 2018

Get the maximum file size that will open under x seconds

My application will be deployed on different platforms with different hardware. I want to find the maximum file size that will open under x seconds in a user platform, in which I install my application. Is there a way to write a c# script type application or even a python that will produce a similar behavior to the time the user will spend opening a file?

I thought about creating a file and in a linear way increase it until it takes around x seconds to open, something like:

int currentFileSize = 10* (int)Math.pow(2,20) // 20MB;
CreateFile(currentFileSize);

var secondsTook = Testopen performance(currentFileSize); // Measure open time with stopwatch
While (Math.Abs(DesiredTimeInSeconds-SecondsTook)>DesiredTimeInSeconds / 1000) 
{
   // Increase file size somehow.
   // Repeat
}

return currentFileSize;

In case I create a completely new file each round, does File.Open() take the exact amount of time it takes for a user to open a file through the explorer? And how would you suggest me to do such a test?

Aucun commentaire:

Enregistrer un commentaire