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

Function fxNewProfilerRecord

xs/sources/xsProfile.c:346–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346txProfilerRecord* fxNewProfilerRecord(txMachine* the, txID recordID)
347{
348 txProfiler* profiler = the->profiler;
349 txU4 recordCount = profiler->recordCount;
350 txProfilerRecord* record;
351 if (recordID >= recordCount) {
352 recordCount = recordID + 1;
353 profiler->records = (txProfilerRecord**)c_realloc(profiler->records, recordCount * sizeof(txProfilerRecord*));
354 if (profiler->records == C_NULL)
355 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
356 c_memset(profiler->records + profiler->recordCount, 0, (recordCount - profiler->recordCount) * sizeof(txProfilerRecord*));
357 profiler->recordCount = recordCount;
358 }
359 record = c_malloc(sizeof(txProfilerRecord));
360 if (record == C_NULL)
361 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
362 record->recordID = recordID;
363 record->hitCount = 0;
364 record->constructorID = XS_NO_ID;
365 record->prototypeID = XS_NO_ID;
366 record->functionID = XS_NO_ID;
367 record->file = XS_NO_ID;
368 record->line = 0;
369 record->calleeCount = 0;
370 record->callees = C_NULL;
371 record->flags = 0;
372 profiler->records[recordID] = record;
373 return record;
374}
375
376void fxPrintID(txMachine* the, FILE* file, txID id)
377{

Callers 2

fxCreateProfilerFunction · 0.85
fxFrameToProfilerRecordFunction · 0.85

Calls 1

fxAbortFunction · 0.70

Tested by

no test coverage detected