Re: Algorithm for determining % complete of a program
- From: "bhoover@xxxxxxxx" <bhoover@xxxxxxxx>
- Date: Wed, 26 Jul 2006 20:02:42 -0400
mross462@xxxxxxxxx wrote:
Hello all,
I'm wondering if there someone could help me investigate an algorithm
for determining the progression status (% complete) of an application
that I'm currently working on. It currently has 4 phases where
different data can be obtained from the program to obtain this
progression status. The application is devided into the following sub
processes, with their corresponding data references.
1. Intialization of objects. (# of types of objects are known)
2. Reading and validating each member of a particular object from a
file. (# of bytes in file read)
3. Validating objects with common values (# of objects with common
values known)
4. Writing a file with the validity tags and addresses of objects (Same
as above)
5. Removing all objects and clearing memory (same as above)
If anyone could point me in a good direction, it would be appreciated.
Thanks
You know in advance there are 5 tasks, T, so percent complete is
totalTasksComplete / T.
Obtain current totalTasksComplete (percent of all tasks complete) by having
each task report it's x / n complete -- accumulate this value in
totalTasksComplete.
This setup has the requirement that you know in advance the total number of
tasks -- but knowing in advance each task's n is not neccessary as each
task simply returns a fraction x / n up to 1 / 1 signifying the task is
complete -- and each task must have some sort of callback installed via
which x / n complete is reported to the progress reporting
thread/interface.
I've implemented this with a proxy between tasks reporting, and reporter
interface(s). Any progress reporting interface registers with the proxy to
receive task reports from task routines. If there's no interface
registered, the proxy simply discards the task reports -- that is, tasks
report their x / n to the proxy. This setup also provides a means to count
the total number of tasks, T, being reported to it -- on a test run -- so
totalTasksComplete / T, in the final program, can be computed, without
having to keep track of what all is reporting thoughout your code -- this
is good, or bad, depending on your perspective of course, but there's
nothing preventing a more rigorous accounting of reporting routines if
that's what you want.
The down side is, scattered reporting calls throughout code -- only in
"tasks" on which reports are desired though. By the same token, the up
side is, the calls can be scattered anywhere task reports might be desired
regardless of whether the reports are actually ever used. You could even
add task identifier parameters, include, and exclude as desired adjusting
progress calculation, and reporting detail accordingly. Tasks can be
further divided into to subtasks, with each task reporting fractions, of
fractions of task complete, and so on... So it's possible to get an
extremely smooth, and accurate progress bar.
The more traditional means of setting up a callback hook with a given task
is preferable -- that way the task only reports if there's a callback
registered, though it still has to test for that -- but the presently
described way works regardless of whether the language supports function
pointers.
Actually, isn't there, or wasn't there such, or similar ADT in Delphi. I
have an implementation in the Windows database programming language,
Paradox.
Bryan
.
- Follow-Ups:
- Re: Algorithm for determining % complete of a program
- From: Logan Shaw
- Re: Algorithm for determining % complete of a program
- References:
- Algorithm for determining % complete of a program
- From: mross462
- Algorithm for determining % complete of a program
- Prev by Date: Re: Question on Shortest path algorithm - Dijkstra
- Next by Date: Re: Endianess
- Previous by thread: Re: Algorithm for determining % complete of a program
- Next by thread: Re: Algorithm for determining % complete of a program
- Index(es):
Relevant Pages
|