Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress Monitor

Status
Not open for further replies.

k4ghg

Technical User
Dec 25, 2001
191
US
I have an application that runs throught certain calculations based on inputs from a user. The number of calculations is stable, but the number of times they are run changes. I want to add a progress monitor to let them know how long it takes, but am not certain how to do this.

I tried suns tutorials without too much sucess. Any suggestions would be appreciated.

Thanks
 
Perhaps so succinct example that will compile on its own here to show us what you have tried ...

--------------------------------------------------
Free Database Connection Pooling Software
 
This is not so hard to do.

There is a class under NetBeans you can use for this one.
You define your minimun value: ex 0 to max value: number of processes ex 10

Then for each process that is finished you increase the value of the process bar.

That's all.

.: Impure :.

 
Thanks for the responces. After collecting input data, I call several classes to process data:
{
.
.
calc.rainfall(County, Date);
irr.effectiveRain(soil, crop, rootZone);
out.outPut(irrigation, date, quantity);
.
.
}
This takes a lot of time and I want to indicate to the uses about how long it will take. The values that I pass are Array lists that will vary each time. Any suggestions? Thanks
 
There can be many other ways to solve your problem, but here is one approach that you may use ...

Since performance varies from machine to machine, it is somewhat hard to predict beforehand how long it may take to complete. So hard-coding the time estimate into the codes may not be the best option. What you can do is that for each class, you can set up a variable that stores the average processing time per item in the array. This variable gets updated from time to time.

For instance, in the class 'calc', everytime the rainfall method is called, you can store the number of item in the array argument and the starting time. When rainfall method is about to finish its job, you get the time it finishes, compute the average processing time per item ((finish-start)/no_of_item), and store this average time for future use. The next time rainfall method is called, you can use this average time to estimate the time it will take (no_of_item * avg_time) to complete the job, and further refine the average time with the new data everytime the method is used. Of course this method will incur some processing time penalty as you now have addional stuffs to process.

Alternatively, you can do a test-run yourself and hard-code the average time per array item into your codes.

 
What I use to do when the processes are iterative is updating the progress monitor in each iteration, if you can know beforehand how many iterations will be, of course.

Cheers.

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top