First of all, your code is very repetitive--you're doing the same thing three times. You might find it better to put most of the code into a subroutine that could get called three times with different values for your different interfaces. There's also a lot of potential cleanup that could be done.
But I think your real problem is that when the counter resets, you're setting the previous value (say, $peth0in) too late, after the division. So you're setting it to the number of bytes per second, not the total number so far.