If given a mapping of file sizes to their respective transfer times, how can I approximate the constant factor that each file will have as overhead?
E.g.
File size Transfer time -------------------------------- 1 kB 2 ms 1000 kB 1001 ms --------------------------------
From this table I can see that each file has an overhead of 1 ms and each kB takes another ms. But how do I do this mathematically?
I need to calculate this in C++ as a moving average for an estimation of remaining copy time and would be grateful for some ideas (just math or pseudocode is ok.)
As you said, there are two variables:
T
is the Time to access one file;A
is the Access time per kilobyte (kB).So, for the two files:
2ms = T + 1A
1001ms = T + 1000A
Subtract 1) from 2):
(1001ms - 2ms) = (T - T) + (1000A - A)
999ms = 0 + 999A
999ms = 999A
A = 1ms
Substitute for A
in 1):
2ms = T + 1
1ms = T
Simple simultaneous equations!