Ejemplo n.º 1
0
	void Sampler::writeRawSample(SampleType sampleType)
	{
		CallStackNode *csn = core->callStack;
		uint32 depth = csn ? csn->depth() : 0;
		byte *p = currentSample;
		write(p, GC::ticksToMicros(VMPI_getPerformanceCounter()));
		write(p, sampleType);
		if(sampleType != DELETED_OBJECT_SAMPLE)
		{
			//if(depth == 0)
			//	AvmDebugMsg(false, "Please add SAMPLE_FRAME's to give this allocation some context.");
			write(p, depth);
			while(csn)
			{
				write(p, csn->info());
				write(p, csn->fakename());
				// FIXME: can filename can be stored in the AbstractInfo?
				write(p, csn->filename());
				write(p, csn->linenum());
#ifdef AVMPLUS_64BIT
				AvmAssert(sizeof(StackTrace::Element) == sizeof(MethodInfo *) + sizeof(Stringp) + sizeof(Stringp) + sizeof(int32_t) + sizeof(int32_t));
				write(p, (int) 0); // structure padding
#endif
				csn = csn->next();
				depth--;
			}
			AvmAssert(depth == 0);
		}
		// padding to keep 8 byte alignment
		align(p);
		currentSample = p;
		takeSample = 0;
	}
Ejemplo n.º 2
0
    ProgramClass::ProgramClass(VTable *cvtable)
        : ClassClosure(cvtable)
    {
        ShellCore* core = (ShellCore*)this->core();
        if (core->programClass == NULL) {
            core->programClass = this;
        }

        createVanillaPrototype();

        // initialTime: support for getTimer
        // todo note this is currently routed to the performance counter
        // for benchmark purposes.
        initialPerfTime = VMPI_getPerformanceCounter();
        initialTime = VMPI_getTime();
    }
Ejemplo n.º 3
0
 double ProgramClass::getNanosecondTimer()
 {
     return ((VMPI_getPerformanceCounter() - initialPerfTime) * 1e9)
         / VMPI_getPerformanceFrequency();
 }