An EdgeCampus sensor logger writes totalBytes bytes to a file. Each write system call costs syscallMicros microseconds, plus nanosPerByte nanoseconds per byte copied.
Input: first line totalBytes syscallMicros nanosPerByte, second line: one or more buffer sizes in bytes.
For each buffer size B print buffer B: calls C, time T ms where C = ⌈totalBytes / B⌉ and T = C × syscallMicros / 1000 + totalBytes × nanosPerByte / 1,000,000 (three decimals). Then print Speedup of best vs 1-byte writes: X (one decimal) — the time with B = 1 divided by the smallest time among the listed sizes (compute the 1-byte time even if 1 is not listed).
Input:
1000000 1 1
1 512 4096 65536
Output:
buffer 1: calls 1000000, time 1001.000 ms
buffer 512: calls 1954, time 2.954 ms
buffer 4096: calls 245, time 1.245 ms
buffer 65536: calls 16, time 1.016 ms
Speedup of best vs 1-byte writes: 985.2