Calculate the MB/s from know milliseconds and bytes
Calculate the MB/s from know milliseconds and bytes
Hi
I have written 2097152 bytes to my drive and it took 635 milliseconds.
How can I calculate the MB/s with Purebasic?
I think:
bytes = 2097152
convert bytes to bit
bit = 2097152 * 8 = 16777216
milliseconds = 635
for 1 milliseconds I have written:
16777216 / 635 = 26.420 bit
now i convert all to MB/s
so:
26.420 / 1024 / 8 = 0.003 MB/s
the logic/formula I have written here is the correct one ?
Thank you
I have written 2097152 bytes to my drive and it took 635 milliseconds.
How can I calculate the MB/s with Purebasic?
I think:
bytes = 2097152
convert bytes to bit
bit = 2097152 * 8 = 16777216
milliseconds = 635
for 1 milliseconds I have written:
16777216 / 635 = 26.420 bit
now i convert all to MB/s
so:
26.420 / 1024 / 8 = 0.003 MB/s
the logic/formula I have written here is the correct one ?
Thank you
Re: Calculate the MB/s from know milliseconds and bytes
Think a bit ...
2097152 bytes are nearly 2MB
If you wrote this in 0.6 seconds, the MB/s must nearly the double value and not 0.00X
2097152 bytes are nearly 2MB
If you wrote this in 0.6 seconds, the MB/s must nearly the double value and not 0.00X
Code: Select all
bytes.i = 2097152
ms.i = 653
MBs.d = bytes / ms * 1000 / 1024 / 1024
;MBs.d = bytes / ms / 1048.576
Debug MBs
Re: Calculate the MB/s from know milliseconds and bytes
Please consider, also 1 MB (mega byte) is a SI unit and exactly 1,000,000. The other unit is 1 MiB (mebi byte), which is 1024*1024.
Binary prefix
Unfortunately, this is also done incorrectly by Windows, which means a 3 TB hard drive is in windows wrongly 2.72 TB
Binary prefix
Unfortunately, this is also done incorrectly by Windows, which means a 3 TB hard drive is in windows wrongly 2.72 TB
Code: Select all
bytes.i = 2097152
ms.i = 653
MBs.d = bytes / (ms*1000)
Debug StrD(MBs, 3) + " MB/s"
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Calculate the MB/s from know milliseconds and bytes
Thank You @ All
Ok, this is the right solution ? (i think)
Ok, this is the right solution ? (i think)
Code: Select all
Global.q myms
Global.i mybytes
Global.d mymbs
mybytes = 2097152
myms = 653
mymbs = mybytes / myms * 1000 / 1024 / 1024
Debug StrD(mymbs,3) + " MB/s"
- NicTheQuick
- Addict
- Posts: 1227
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Calculate the MB/s from know milliseconds and bytes
That was quite a while ago. Just read the Wiki article STARGÅTE has linked.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Calculate the MB/s from know milliseconds and bytes
Yeah, I did read the article. It's all BS as far as I'm concerned, and only changed because regular non-computer people didn't understand why a MB wasn't 1,000,000 bytes; so the powers-that-be changed it to suit the noobs for marketing reasons. Sigh.
Re: Calculate the MB/s from know milliseconds and bytes
ok
I think the formula will still be the same, it changes the result a little, but the formula, that's it, right?
- NicTheQuick
- Addict
- Posts: 1227
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Calculate the MB/s from know milliseconds and bytes
It changed because MB was not the same as MB and that's just confusing. Now it is MiB and that's all. It is now properly defined.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Calculate the MB/s from know milliseconds and bytes
Re-defined, just like so many other things these days.
Both MB and Megabyte always originally meant 1,048,576 bytes:
https://www.backblaze.com/blog/how-many ... te-really/
This is also evidenced in old computer magazine articles from the 60s, 70s and 80s.
From "History of the Computer" (https://studylib.net/doc/9055570/histor ... e-computer):
"MB stands for megabytes. 1048576 bytes"
From Microsoft's "Computer Basics: Student Edition" (https://www.uc.edu/webapps/af/hr/CUSTOM ... basics.pdf):
"After the kilobyte, the next largest unit is the megabyte. A megabyte (abbreviated M or MB) equals 1,048,576 bytes or characters".
Even Windows (the OS) shows a file of 1,048,576 bytes as being "1 MB" in size:
Yes, I know I'm being pedantic about this, so I'll stop now.
Last edited by BarryG on Tue Jan 25, 2022 12:52 pm, edited 8 times in total.
Re: Calculate the MB/s from know milliseconds and bytes
I always thought:
MB = MegaBytes
Mb = MegaBits
MB = MegaBytes
Mb = MegaBits
Re: Calculate the MB/s from know milliseconds and bytes
No. The "computer people" just defined MB (mega byte) as 1,048,576 byte even if the word mega is a SI prefix and is defined as 1,000,000 even before computer were present.
In terms of science, it was a necessary step to correct this (in my opinion).
Yes, but this doesn't mean that it is (still) correct. --> (in terms of a scientist)
As I said, when ever you bought a hard drive disk, the size is always in SI-units and then you wonder, why 10% size is missing in windows ^^
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
- Michael Vogel
- Addict
- Posts: 2677
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Calculate the MB/s from know milliseconds and bytes
Cool - it's like talking about religion, politics or COVID
The personal perspective to this mega subject is not only a question of the geographical location but also of the personal age. When I started computing, technicans (they aren't scrientists, are they?) did say 'K' (=1024) not kilo ('k'=1000) and so a new 'M' (pronounced correctly as 'em') for 1<<20 was created additionally to the traditional 'M' (pronounced as mega) for 10^6. So all programs used 'M' (before 'Mi' has been invented) and a lot of them are still doing so.
Hard disks in the beginning of the computer era used the 'M' as well for 1024x1024, the simple reason why hard disk manufacturers understood to move (!) quickly using SI units is to maximize their profit.
@Simo_na - yes, your formula is perfect now
The personal perspective to this mega subject is not only a question of the geographical location but also of the personal age. When I started computing, technicans (they aren't scrientists, are they?) did say 'K' (=1024) not kilo ('k'=1000) and so a new 'M' (pronounced correctly as 'em') for 1<<20 was created additionally to the traditional 'M' (pronounced as mega) for 10^6. So all programs used 'M' (before 'Mi' has been invented) and a lot of them are still doing so.
Hard disks in the beginning of the computer era used the 'M' as well for 1024x1024, the simple reason why hard disk manufacturers understood to move (!) quickly using SI units is to maximize their profit.
@Simo_na - yes, your formula is perfect now
Re: Calculate the MB/s from know milliseconds and bytes
not all, some have remained honestMichael Vogel wrote: ↑Tue Jan 25, 2022 3:08 pm
Hard disks in the beginning of the computer era used the 'M' as well for 1024x1024, the simple reason why hard disk manufacturers understood to move (!) quickly using SI units is to maximize their profit.