Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CPUMon.dll - Win98 problem
Message
 
 
À
23/09/2004 16:40:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00941363
Message ID:
00945549
Vues:
51
>>
>>Hi Gunnar, I happen to have an XP laptop with me at the moment so I will have a look at it on that, will probably have to use my VFP 7 CD though (lost my VFP 6 CD in Denver Colorado back in 98 or 99! The code hasn't changed in a long time, to the best of my recollection.
>>
>>Basically the routine takes sucessive snapshots of HKEY_PERFORMANCE_DATA - this is a monster piece of encoded data (still an understatement), from which the number of elapsed clock cycles used by the System Idle Process (single threaded) is determined. The difference in successive values (delta) gives you an accurate measure of CPU clock cycles used by all other processes. i.e. if two successive readings from the System Idle Process are identical, then 100% of the clock cycles were used by other processes - i.e. your system is CPU bound. The math (in theory) is trivial.
>>
>>From CodeProject.com i found the following:
The cpu usage counter is of type PERF_100NSEC_TIMER_INV which has the following calculation:
>>
>>100*(1-(X1-X0)/(Y1-Y0))
>>  X - CounterData
>>  Y - 100NsTime
>>  Time base - 100Ns
Nothing new here from my perspective, I thought this was what I was doing:
iPreviousCounter = 0
>>iPrevious100Time = 0
>>DO WHILE LASTKEY() # 32
>>	*************************************************
>>	cRegValue = fGetRegValue( "238" ;
>>			, 1024 * 4 ;
>>			, HKEY_PERFORMANCE_DATA )
>>	*************************************************
>>	IF cRegValue = "ERROR"
>>		EXIT
>>	ENDIF
>>
>>	iPerf100Time = fStrToInt( SUBSTR( cRegValue, 73, 8 ))
>>	iDeltaTime = iPerf100Time - iPrevious100Time
>>
>>	iCounter = fStrToInt( SUBSTR( cRegValue, iCounterOffset, 8 ))
>>	iDeltaCounter = iCounter - iPreviousCounter
>>
>>	? 100 * ABS( 1 - ( iDeltaCounter / iDeltaTime ))
>>	
>>	iPreviousCounter = iCounter
>>	iPrevious100Time = iPerf100Time
>>ENDDO
I checked that the index into the HKEY_PERFORMANCE_DATA is still 238. I wrote the code Summer 2000 and was probably using Windows 2000 Pro - so what is bizarre is that it no longer works on my Win2KPro SP4. I am seeing the same numbers as you. Maybe the iCounterOffset has changed and I am no longer calculating it correctly.
>>
>>Division takes precedence over substration, right???
>>
>>I'll get back to you shortly.
>
>Hello Houston.
>
>Thanks for your help. i don't have your code with me right now, but i'll compare it later 2today.
>
>and yes: "Division takes precedence over substration, right???". in germany we have a saying: "Punkt Rechnung for Strich Rechnung", which translates: "Point calculation goes befor line calculation" (that is a translation from bablefish, i don't know the english equivilant to it <s>). that means that multiplications and devissions are calculated before additions and substractions.
>
>thanks for your help again.

Hi Gunnar, I've just e-mailed you an alternative technique using PDH.DLL - I am not sure if this is available on Win98 or if copied to a Win98 box is going to have its dependencies satisfied. Hope this helps.

Wow, the auto acknowledgment bounced back before the screen could refresh - that is sub 1 second !!!
censored.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform