It is currently September 29th, 2024, 1:19 pm

UnpauseMeasure and DisableMeasure a counter

General topics related to Rainmeter.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

UnpauseMeasure and DisableMeasure a counter

Post by AlC »

Hey guys,

I noticed a behaviour with counters and I don't know if it's a bug or normal.

Szenario 1:
Counter (mCalc+1) counts, and when I then disable the calc, the value gets 0. -> Normal

Szenario 2:
Counter (mCalc+1) counts, and when I then pause it, the value stay. -> Normal

Szenario 3:
Counter (mCalc+1) counts, and when I then pause it, then disable it, the value stay. -> Normal or bug? When I disable the measure normally the value should be 0, isn't it?

Szenario 4:
Counter (mCalc+1) counts, and when I then pause it, then disable it, the value stay. And if I then unpause it (the calc is disabled!) the value gets 0. -> strange.

So is this a bug or a normal behaviour?
Hope you understand it :)
Rainmeter - You are only limited by your imagination and creativity.
User avatar
Brian
Developer
Posts: 2736
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: UnpauseMeasure and DisableMeasure a counter

Post by Brian »

This is all perfectly normal behavior. This is how I designed it anyway. I remember running into the exact same issues when testing, however, the team decided to have behave this way.

When a measure is updated, it first checks if the measure is paused. If it is paused, it returns the current number value (whatever it may be). If it is not paused, it then checks to see if it is disabled. If it is disabled, it returns 0. Else it will return whatever it is measuring.

So although it seems off, you are seeing the correct, designed, behavior. I don't think it would be good skin design to disable a paused measure - or pause a disabled measure.

-Brian
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: UnpauseMeasure and DisableMeasure a counter

Post by AlC »

1. Thank you very much for the explanation!
2. Sorry for the late reply, I have to thought about this :)
Brain wrote:So although it seems off, you are seeing the correct, designed, behavior. I don't think it would be good skin design to disable a paused measure - or pause a disabled measure.
Sometimes you have to ;)
Brain wrote:When a measure is updated, it first checks if the measure is paused. If it is paused, it returns the current number value (whatever it may be). If it is not paused, it then checks to see if it is disabled. If it is disabled, it returns 0. Else it will return whatever it is measuring.
I'm at the beginning of a skin with a lot of calcs and meters, so I look after my CPU. So my question, is then a paused calc "CPU-friendlier" than a disabled calc?
Rainmeter - You are only limited by your imagination and creativity.
User avatar
Brian
Developer
Posts: 2736
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: UnpauseMeasure and DisableMeasure a counter

Post by Brian »

AlC wrote:Sometimes you have to ;)
I am not so sure, since the only difference between the two are whether the number value of the measure gets set to 0 or not.

AlC wrote:I'm at the beginning of a skin with a lot of calcs and meters, so I look after my CPU. So my question, is then a paused calc "CPU-friendlier" than a disabled calc?
Technically speaking, a paused measure will be faster because it doesn't set any value - it just immediately returns during the update cycle. Whereas a disabled goes the trouble of setting the number value of the measure to 0.

But I highly doubt you would notice any difference between the two as far as CPU usage.

-Brian
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: UnpauseMeasure and DisableMeasure a counter

Post by AlC »

Brian wrote:I am not so sure, since the only difference between the two are whether the number value of the measure gets set to 0 or not.
It's hard to explain it with my poor english skills, but I save a lot of code if I pause the counters and then (when all counters are paused) unpause and disable them all with one action. Maybe I finish the skin in some days, weeks..
Brian wrote:Technically speaking, a paused measure will be faster because it doesn't set any value - it just immediately returns during the update cycle. Whereas a disabled goes the trouble of setting the number value of the measure to 0.

But I highly doubt you would notice any difference between the two as far as CPU usage.

-Brian
Ok, thank you very much again Brian.
Rainmeter - You are only limited by your imagination and creativity.