Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Estimating processing Time
Message
 
 
To
31/03/2004 10:21:38
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00891010
Message ID:
00891195
Views:
21
Jeffrey,

>Where do I get this tool from?

Well I wrote it and it's not posted anywhere. But here is the classbrowser dump of the code.
**************************************************
*-- Class:        cprogress 
*-- ParentClass:  custom
*-- BaseClass:    custom
*-- Time Stamp:   02/15/00 07:30:00 PM
*
DEFINE CLASS cprogress AS custom


	*-- mnRecords - number of records to process
	mnrecords = 0
	*-- miRecord - iteration counter
	mirecord = 0
	*-- mtStart - time process started
	mtstart = {^1999/01/01 00:00:00}
	*-- mnDisplayInterval - number of records before display updates
	mndisplayinterval = 1000
	*-- mlIncludeDate - set to .t. if you want the estimated completion time to include the date
	mlincludedate = .F.
	Name = "cprogress"


	*-- Iterate - called for each record processed
	PROCEDURE update
		with this
		   .miRecord = .miRecord + 1
		   if ( ( .miRecord % .mnDisplayInterval ) = 0 )
		      local lnPerRecord
		      lnPerRecord = ( datetime() - .mtStart ) / .miRecord
		      @$,17 say str( lnPerRecord, 9, 5 )
		      if ( .mlIncludeDate )
		         @$,52 say ttoc( datetime() + ( .mnRecords - .miRecord ) * lnPerRecord ) + ;
		                   "   it is now: " + time()
		      else
		         @$,52 say ttoc( datetime() + ( .mnRecords - .miRecord ) * lnPerRecord, 2 ) + ;
		                   "   it is now: " + time()
		      endif
		   endif
		endwith
	ENDPROC


	*-- FinalStatistics - provide final run statistics
	PROCEDURE finalstatistics
		local lnElasped, lcRetVal

		lnElasped = datetime() - this.mtStart
		lcRetVal = "Total time:" + ttoc( {^1999-01-01, 00:00:00} + lnElasped, 2 ) + ;
		           " Seconds/per record" + str( lnElasped / this.miRecord, 9, 5 )

		return lcRetVal
	ENDPROC


	PROCEDURE Init
		lparameter pnDisplayInterval

		with this
		   .miRecord = 0
		   .mtStart = datetime()
		   .mnRecords = reccount()

		   if ( pcount() > 0 )
		      .mnDisplayInterval = pnDisplayInterval
		   endif
		endwith

		? && make sure we are on a blank line to start
		@$,1 say "Seconds/record:"
		@$,27 say "Estimated finish time:"
	ENDPROC


ENDDEFINE
*
*-- EndDefine: cprogress
**************************************************
It's usage is like:
select TheTable
loProgress = createobject( "cProgress" )
scan
   loProgress.Update()
   ... 
endscan
? loProgress.FinalStatistics()
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform