It is currently March 28th, 2024, 2:56 pm

Reset Average FPS Counter Every 30 seconds

Get help with creating, editing & fixing problems with skins
Post Reply
Sapphica69
Posts: 15
Joined: June 9th, 2020, 4:06 am

Reset Average FPS Counter Every 30 seconds

Post by Sapphica69 »

I'm trying to reset an Average FPS counter every 30 seconds.
This is the code I have so far:

Code: Select all

[TimerLoop]
Measure=Loop
StartValue=1
EndValue=((#ChangeInterval#*30)-1)
Increment=1
LoopCount=0
OnUpdateAction=[!SetVariable TimerNum (Trunc([TimerLoop]/#ChangeInterval#)+1)]
DynamicVariables=1

[MeasureFPSAvg]
Measure=Plugin
Plugin=Plugins\MSIAfterburner.dll
DataSource=Framerate Avg
MinValue=0
MaxValue=800

[CalcFPS]
Measure=Calc
Formula=MeasureFPS>800?0:MeasureFPS>4?MeasureFPS:0

[CalcAvg]
Measure=Calc
Formula=CalcFPS>0?(CalcTotalFrames/CalcFramesCount):CalcAvg
DynamicVariables=1

[CalcTotalFrames]
Measure=Calc
Formula=CalcFPS>0?CalcTotalFrames+CalcFPS:CalcTotalFrames

[CalcFramesCount]
Measure=Calc
Formula=CalcFPS>0?CalcFramesCount+1:CalcFramesCount

What I'm stuck on is how to write in when TimerNum=30 then reset calculations?
Sapphica69
Posts: 15
Joined: June 9th, 2020, 4:06 am

Re: Reset Average FPS Counter Every 30 seconds

Post by Sapphica69 »

Still stuck on this lol
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reset Average FPS Counter Every 30 seconds

Post by balala »

Sapphica69 wrote: January 14th, 2021, 12:49 am Still stuck on this lol
I'm not using MSI Afterburner (and obviously nor its plugin), so I might be wrong here, but I'd try to add something like this to your code:

Code: Select all

[MeasureReset]
Measure=Calc
Formula=( COUNTER % 30 )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!DisableMeasure "MeasureFPSAvg"][!UpdateMeasure "MeasureFPSAvg"][!EnableMeasure "MeasureFPSAvg"]
The measure counts from 0 to 30 (due to the used 30 in the Formula option) and when it gets 0, disables, updates, then reenables the measure. This resets a (let's say) "normal" measure, however what am I not sure about, is what does with the plugin measure.
Sorry if I am wrong.
Sapphica69
Posts: 15
Joined: June 9th, 2020, 4:06 am

Re: Reset Average FPS Counter Every 30 seconds

Post by Sapphica69 »

Thank you so much for the help Balala! I greatly appreciate it. :great:
balala wrote: January 14th, 2021, 7:33 am however what am I not sure about, is what does with the plugin measure.
Sorry if I am wrong.
Sorry I didn't past in the right code. That was my bad. This was the right code.

Code: Select all

[MeasureFPS]
Measure=Plugin
Plugin=MSIAfterburner.dll
DataSource=Framerate
MinValue=0
MaxValue=800
DynamicVariables=1

[CalcFPS]
Measure=Calc
Formula=MeasureFPS>800?0:MeasureFPS>4?MeasureFPS:0

[CalcAvg]
Measure=Calc
Formula=CalcFPS>0?(CalcTotalFrames/CalcFramesCount):CalcAvg
DynamicVariables=1

[CalcTotalFrames]
Measure=Calc
Formula=CalcFPS>0?CalcTotalFrames+CalcFPS:CalcTotalFrames

[CalcFramesCount]
Measure=Calc
Formula=CalcFPS>0?CalcFramesCount+1:CalcFramesCount
This Code Calculates Average Fps bases on current frame rate. Also doesn't count fps over 800 Fps.

I added your code and modified it to be based off CalcAvg

Code: Select all

[MeasureReset]
Measure=Calc
Formula=( COUNTER % 15 )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!DisableMeasure "CalcAvg"][!UpdateMeasure "CalcAvg"][!EnableMeasure "CalcAvg"]
It works pretty well but the issue I have now is when I switch games CalcAvg starts at the value it last read even though it reset to 0.

So basically I start a 3d app and get a read out of lets say 91fps and 89 average fps. I exit out of it, then Fps and CalcAvg resets to 0 like it should. Then I start another 3d app and Fps will be at 140fps, but CalcAvg will start at 89 fps and calculate from there. I don't really know why it seems to remember the previous value even though it reset to 0?? Any ideas?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reset Average FPS Counter Every 30 seconds

Post by balala »

Sapphica69 wrote: January 14th, 2021, 8:02 pm Any ideas?
Well, unfortunatly I'm not sure at all what to say, because as said, I'm not using neither MSI Afterburner and obviously even less its plugin. Probably here someone else who is using these will have to help you. Sorry...
Post Reply