Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I calculate MB/s & MiB/s?

Tags:

c

I've recently discovered that MB/s is technically equivalent to 8 million bits/s and not 10242 bits per second which should be called a Mebibyte.

This should be easy, but when comparing output from various sources I get different answers, even from google which thinks there is no difference at all between the measures.

If I transfer 1381530 bytes in 17797601 nanoseconds, what is the data rate in those two measures? and what is the formula you're using to calculate it?

Currently I have: where duration is in nanoseconds.

double data_rate_MiBps = (num_bytes/1024/1000) / ((double)duration * 1e-9);
double data_rate_MBps = (num_bytes/1024/1024) / ((double)duration * 1e-9);

Thanks for the responses. I was ending up with numbers that didn't make sense before but now they do. The above code should be the following:

double data_rate_MiBps = (num_bytes/1024.0/1000.0) / ((double)duration * 1e-9);
double data_rate_MBps = (num_bytes/1024.0/1024.0) / ((double)duration * 1e-9);

I therefore get:

74.085 MiB/s
75.863 MB/s

Which I think makes sense.

Probably a better question. Why in the first place was 1024 bytes chosen to be 1KB instead of 1000. Since Kilo (etc) = 1000 everywhere else.

like image 742
hookenz Avatar asked Jan 18 '12 04:01

hookenz


People also ask

Whats the difference between Mbps and MB S?

Mb/s is used to measure internet download and upload speeds. MBps (or MB/s) with an uppercase "B" means megabytes per second. MB/s is used to measure file size, or the speed of data transfer. One megabyte is technically equal to eight megabits, but you rarely use the terms to refer to the same thing.

How do you convert Mbps to seconds?

1 Megabit/s = 0.125 Megabytes/sec.

What does 1 MB S mean?

1,000 kilobits are called 1 megabit (Mb). Essentially, 1 megabit consists of 1,000,000 bits. So, 1Mbps is the rate of transfer of one million bits per second. If we take this one step higher, a thousand Megabits are called a Gigabit (Gb). This equals 1 billion bits.

How do you calculate download speed per second?

All you need to remember is this simple formula: File Size In Megabytes / (Download Speed In Megabits / 8) = Time In Seconds. A 15 Megabyte file, downloading at 10 Megabits per second: 15 / (10/8) = 12 seconds.


2 Answers

If I transfer 1381530 bytes in 17797601 nanoseconds, what is the data rate in those two measures?

0.0776 bytes/ns.

First, careful:

I've recently discovered that MB/s is technically equivalent to 8000 million bits/s

I've never heard of this definition.

"MB/s" usually means "megabytes per second". This can be one of two definitions, depending on who you ask:

  • 1 million bytes per second (8 million bits per second) (per the IEEE's definition)
  • The more commonly seen definition of 1024 * 1024 (1048576) bytes per second (8388608 bits per second), seen commonly in many usages.

In some really, really rare cases, "MB/s" could mean "megabits per second", but megabits per second is usually abbreviated to "Mbps" or "Mbits/s". The context will most often clue you in on which is appropriate: wireless transmission speeds, ethernet cards, etc. are typically measured in megabits per second; file transfers over the internet are measured in megabytes (or mebibyte, see next paragraph) per second.

The IEEE has proposed that computers should follow the SI prefixes, and use "Kilobyte" to mean 103 bytes, not 210 bytes, which has been done historically. (And thus created all the confusion over which definition of a megabyte one is actually using.) However, in many contexts, 103 makes little sense, so different "binary" prefixes were introduced, such as the "Kibibyte", which is abbreviated KiB and always means 1024 bytes. In your case, there is it "Mebibyte", or MiB (and when per second, MiB/s) and means 1024*1024 bytes.

See the Wikipedia article on the Megabyte for more info.

(For the conversions to bits/s, I've assumed 8 bits/byte.)

like image 113
Thanatos Avatar answered Oct 22 '22 13:10

Thanatos


See

1> Megabyte per second

A megabyte per second (MB/s or MBps) is a unit of data transfer rate equal to:

1,000,000 bytes per second,

2> Megabit per second

A megabit per second (Mbit/s, Mb/s, or Mbps) is a unit of data transfer rate equal to:

1,000,000 bits per second

3>Mebibyte per second

A mebibyte per second (MiB/s or MiBps) is a unit of data transfer rate equal to:

1,048,576 bytes per second, or

4>Mebibit per second

A mebibit per second (Mibit/s or Mib/s) is a unit of data transfer rate equal to:

1,048,576 bits per second or

like image 30
Jeegar Patel Avatar answered Oct 22 '22 12:10

Jeegar Patel