[Papervision3D] CPU usage metering?

Memmie Lenglet memmie at lenglet.name
Thu May 15 07:12:47 PDT 2008


You can't directly, but estimate CPU usage with frame latency (anormal interval between 2 frame due to CPU usage)

<code>
protected var lastFrameTime:uint = getTimer();
protected function renderScene(event:Event):void
{
	var currentFrameTime:uint = getTimer();
	//Frame rate
	var frameRate:Number = 1000 / (currentFrameTime - this.lastFrameTime);
	//Latency
	var frameLatency:Number = (currentFrameTime - this.lastFrameTime) - 1000 / this.stage.frameRate;
	//Use this for having latency compensation
	myDisplayObject3D.x += SPEED * (currentFrameTime - this.lastFrameTime);//SPEED in 3Dunit/ms
}
</code>

When frame latency is arround 20ms it low CPU usage, around 100ms is intensive CPU usage or more.
But i'm not sure for this values, NEED to be tested.

Carlos Lunetta a écrit :
> Eduardo Omine wrote:
>> import flash.system.System;
>> System.totalMemory indicates RAM memory usage (measured in bytes).
>>
>>   
> Hi Eduardo
> 
> I'm talking about CPU usage, not memory.
> 
> Thanks anyway,
> 
> Carlos
> 
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org




More information about the Papervision3D mailing list