MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxPushProfilerSample

Function fxPushProfilerSample

xs/sources/xsProfile.c:542–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540void fxPushProfilerSample(txMachine* the, txID recordID, txU4 delta, txU4 deltaMeter)
541#else
542void fxPushProfilerSample(txMachine* the, txID recordID, txU4 delta)
543#endif
544{
545 txProfiler* profiler = the->profiler;
546 txU8 sampleCount = profiler->sampleCount;
547 txU8 sampleIndex = profiler->sampleIndex;
548 txProfilerSample* sample;
549 if (sampleIndex == sampleCount) {
550 sampleCount += 1024;
551 profiler->samples = (txProfilerSample*)c_realloc(profiler->samples, (size_t)(sampleCount * sizeof(txProfilerSample)));
552 if (profiler->samples == C_NULL)
553 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
554 profiler->sampleCount = sampleCount;
555 }
556 sample = profiler->samples + sampleIndex;
557 sample->recordID = recordID;
558 sample->delta = delta;
559#ifdef mxMetering
560 sample->deltaMeter = deltaMeter;
561#endif
562 profiler->sampleIndex = sampleIndex + 1;
563}
564
565txID fxRemoveProfilerCycle(txMachine* the, txProfiler* profiler, txID recordID)
566{

Callers 1

fxCheckProfilerFunction · 0.85

Calls 1

fxAbortFunction · 0.70

Tested by

no test coverage detected