troubleshooting Question

Calculating ETA from only a percentage of progress

Avatar of mrwad99
mrwad99Flag for United Kingdom of Great Britain and Northern Ireland asked on
System Programming
4 Comments1 Solution542 ViewsLast Modified:
Ah hello.

I have a class function.  That function starts a thread, whose sole purpose is to call an SDK function.  That SDK function reports progress back via a special CALLBACK function.  I would like to be able to report to the user an estimate of how long the SDK function will take to complete.

Now then.

All that I get back from the SDK is a double representing the progress so far; between 0 and 1.0.  Not very useful.  So I put some thought in, and came up with the idea of having an independent timer running alongside the SDK CALLBACK.  Setting the timer up to send a message to me every one second, I could wait until, say, two seconds have passed, then look at how much progress has been made in the CALLBACK.  I could then base calculations on the time remaining around the fact that on average, ( progress made in two seconds / 2 ) % progress is made every one second.  And go from there...

This sounds a bit messy though.  I would need some sort of member variable holding the number of seconds passed as reported by my timer, that the CALLBACK also has access to.  Then I would need to protect access to that variable possibly...

Not a serious problem, but I am guessing that someone has come across this kind of issue before.

Any better ideas ?

TIA
ASKER CERTIFIED SOLUTION
krbatge

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros