c# - How can I eliminate the "jitter" from my "estimated time remaining" (and ETA) calculation? -



c# - How can I eliminate the "jitter" from my "estimated time remaining" (and ETA) calculation? -

i have application that, while performing background task, shows progress bar "estimated time remaining" calculation (eg "5 seconds remaining") , "estimated time of completion" (eg "complete @ 12:59:59"), or phone call it, eta.

the algorithm calculating eta takes "rolling average" of progress on time: 1. each progress event gets added queue current time. 2. after duration (eg. 10s), items removed queue. 3. eta extrapolated first , lastly items in queue. source code available if care: etacalculator.cs

however, there's jitter problem. each progress event added calculation, eta updated slightly. let's eta changes 0.1s. little jitter causes eta "flutter". example, instead of seeing smooth progression 5s, 4s, 3s, etc..., see 5-5-5-4-5-4-5-4-5-4-4-4.

i thinking of reducing updates 1-per-second, progress bar less smooth, , i'd "actual" slowdowns shown real time.

i'm having problem coming simple algorithm reduces jumpy jitter. how can remove jitter?

separate actual jittery progress , displayed progress 2 separate variables.

update jittery progress now.

at regular (relatively quick) interval, update displayed progress approach actual progress.

a simple approach algorithm average 2 values

display_progress = (display_progress + actual_progress) / 2

this dampen value reflect past values , not immediate value.

you can refine smoothness using:

display_progress = (p) * display_progress + (1.0-p) * actual_progress

where p constant value between 0.0 , 1.0.

edit:

this 1 of many filters used. 1 nice in doesn't require much bookkeeping.

however, getting perfect output not going option, because flaw in input. difference between "jitter" , "actual slowdowns" observable after has happened.

c# .net progress

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -