How to get the micro time possibly using the Sampler classes in Flash?

68 Views Asked by At

I've tried everything to get the microtime in Flash using the sampler class but to no avail. Here is my code so far:

import flash.sampler.Sample;
import flash.sampler.getLexicalScopes;
import flash.sampler.getMemberNames;
import flash.sampler.getSampleCount;
import flash.sampler.getSamples;
import flash.sampler.getSize;
import flash.sampler.startSampling;
import flash.sampler.stopSampling;

private function init():void {

    startSampling();

    var x:String = "Hello world";

    stopSampling();

    var samples:Object = getSamples();
    var sampleCount:int = getSampleCount(); // 0
}

Here is the Sampler and SamplerScript extensions classes. It is calling setconst_time to get the time. It may also be calling another method:

uint64_t Sampler::nowMicros()
{
    return GC::ticksToMicros(VMPI_getPerformanceCounter());
}

As seen in Sampler core class.

I was hoping there was a getMicroTime() method (see getTimer()) but there is not. So I was trying to create samples before and after a code block. Calling getSamples should return an array of Sample objects. Each Sample instance should has a sample.time property with the time in micro seconds. But, using the code above, no samples are taken. The sample count is zero.

0

There are 0 best solutions below