It is currently March 29th, 2024, 11:15 am

I really need help to transform NetIn measure into percentage

Get help with creating, editing & fixing problems with skins
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

I really need help to transform NetIn measure into percentage

Post by Rambytes »

Hi, first, excuse-me for my english....

So, i'm created a download module in rainmeter. At this point, no problem. But I want to have TOO a percentage of the speed of my download. But I don't know how. I've try many time without success.

Code: Select all

[measureNetIn]
Measure=NetIn

[DownloadPercent]
Measure=Calc
Formula=Round(measureNetIn/35756441)

[MeterDownloadPourcent]
Meter=String
MeasureName=DownloadPercent
X=100
Y=130
NumofDecimals=1
AutoScale=1
Antialias=1
Text=%1%
This is the part of my code.

This is the value I got in Speedtest: 34.1 Mbps. I've read that NetIn use the bits format, so i've convert the 34.1Mbps: result is 35756441

But just why it's not working???

Thanks a lot (and I will do the same for my upload)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: I really need help to transform NetIn measure into percentage

Post by jsmorley »

Rambytes wrote:Hi, first, excuse-me for my english....

So, i'm created a download module in rainmeter. At this point, no problem. But I want to have TOO a percentage of the speed of my download. But I don't know how. I've try many time without success.
Actually NetIn / NetOut are measured internally in bits per second, but multiplied by 8 to display in bytes per second.

https://docs.rainmeter.net/manual/measures/net/


What I do is:

Code: Select all

[Variables]
Interface=Best
MaxDownloadMb=100.00
MaxUploadMb=9.00

[MeasureNetIn]
Measure=NetIn
Interface=#Interface#
MinValue=0
MaxValue=(#MaxDownloadMb# * 1000000)

[MeasureNetOut]
Measure=NetOut
Interface=#Interface#
MinValue=0
MaxValue=(#MaxUploadMb# * 1000000)
So I take the value of my rated speed from Speedtest.net in megabits, and multiply it by 1000000 to change it to bits. Although the Net measures display in bytes, as I said, internally they are in bits, and any MaxValue you set should be in bits.

Then you can use the value of the measures as is with Bar meters or other meter types that require a percentage, and can use the percentage values with a String meter by setting Percentual=1 on the meter.

https://docs.rainmeter.net/manual/meters/string/#Percentual

Alternatively, in a String meter you can use a section variable such as [MeasureNetIn:%], along with DynamicVariables=1, to use the percentage in the Text option of the String meter.

https://docs.rainmeter.net/manual/variables/section-variables/#Percentual

The actual value that will be displayed in a String meter will be in bytes per second, although you can change that with UseBits=1. That only impacts the value displayed, and has nothing to due with any percentage.

https://docs.rainmeter.net/manual/measures/net/#UseBits

Be aware that different applications that measure network traffic may use different scales for "mega", in that there are two:

1) mebibit or Mib, which is 1024 X 1024 or 1048576 bits
2) megabit or Mb, which is 1000 X 1000 or 1000000 bits

https://en.wikipedia.org/wiki/Data-rate_units#Mebibit_per_second

Up to you how you want to use AutoScale in String meters. I believe that Speedtest.net uses megabit / Mb, so I use 1000000 to set MaxValue, and use AutoScale=2 on String meters to scale by 1000, which shows me scaled bytes per second. I prefer bytes to bits as although "speed" is generally measured in bits, "download / upload", which is related to "files" , is generally expressed in bytes. That is your call.

https://docs.rainmeter.net/manual/meters/string/#AutoScale

To be honest I visually depend more on using Bar meters to show the percentage of my total bandwidth that is being used, as that is a more satisfying and less confusing metric.

There is plenty of confusion about these scales to keep you busy. Files in Windows are measured in mebibytes or 1048676 bytes, but are labeled as if they are in megabytes, just to make sure it isn't clear for anyone. That 1TB hard drive you bought should be 1000000000000 bytes or 1000MB in size, but check it in Windows. It will displayed there as having a capacity 932MB or thereabout. All depends on who is trying to sell what...
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: I really need help to transform NetIn measure into percentage

Post by Rambytes »

WOW THANKS!!!!!!!!!!!!!

Really good.... Amazing, WOW!!!!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: I really need help to transform NetIn measure into percentage

Post by jsmorley »

Rambytes wrote:WOW THANKS!!!!!!!!!!!!!

Really good.... Amazing, WOW!!!!
Glad to help.