SunilWang / node-os-utils

OS Utils - An operating system utility library.
https://www.npmjs.com/package/node-os-utils
MIT License
125 stars 19 forks source link

osu.mem.info() totalMemMb is actually MiB #14

Open connerdassen opened 3 years ago

connerdassen commented 3 years ago

The function from the title is called .totalMemMb, which suggests a return value in megabit. I found the actual return value to be in MiB, (mebibytes) (Mb = megabit, MB = megabyte, MiB = mebibyte, there's a difference!)

Therefore I think the function name should be changed to .totalMemMib.

SunilWang commented 3 years ago

@kontenbonker

The difference is small。 Although there are differences, I think you can ignore difference。 Do you think?

connerdassen commented 3 years ago

Actually, since Mb is megabit, the difference is quite a lot. On my server with 64GB ram, the return value of the function is 65365,1484375, which is the amount of MiB. If it were actually in Mb like the name suggests, the amount should be 574957,9260666838. That's about 8.8 times more.

SunilWang commented 3 years ago

@kontenbonker Can you provide the Mb algorithm, commit a Pull requests?