| Description:Routine to find Estimated Time for a process to Complete By: Neil Britto http://neilbritto.i.am This routine is very simple. Basically, you need To have a frame of reference, like the number of records you are about to process. We first define some terms, START_TIME = Time the process was started RECORDS_PROCESSED = Number of records read so far TOTAL_RECORDS = Total number of records to be processed Calculation : Records Processed Time Taken -------------------------------------------------------------------------------------------------------------------------------- [RECORDS_PROCESSED] NOW –START_TIME [TOTAL_RECORDS - RECORDS_PROCESSED] x We need To find the time it will take to process the remaining records i.e. [TOTAL_RECORDS - RECORDS_PROCESSED] x = ([TOTAL_RECORDS - RECORDS_PROCESSED] * [NOW – START_TIME])/RECORDS_PROCESSED Visual Basic Code fragment: Dim START_TIME as Date Dim RECORDS_PROCESSED as Long Dim TOTAL_RECORDS as Long Dim ESTIMATED_TIME As Date Before the main processing loop: TOTAL_RECORDS = < START_TIME = NOW Somewhere In your processing Loop RECORDS_PROCESSED = RECORDS_PROCESSED + 1 If RECORDS_PROCESSED <> 0 And RECORDS_PROCESSED Mod 100 = 0 Then ESTIMATED_TIME = ((TOTAL_RECORDS - RECORDS_PROCESSED )* (Now - START_TIME)) / RECORDS_PROCESSED ‘Display the result somewhere Label1.Caption = "Estimated time remaining : " & Format(ESTIMATED_TIME, "hh:mm:ss") End If |
Estimated Time for a process to complete |
India web developer web development India | Freelance web development ecommerce web developer | Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design