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

Function espInitInstrumentation

xs/platforms/nrf52/xsHost.c:271–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269#endif
270
271void espInitInstrumentation(txMachine *the)
272{
273#if MODDEF_XS_TEST
274 static uint8_t initialized = 0;
275 if (initialized)
276 return;
277 initialized = 1;
278#endif
279
280 modInstrumentationInit();
281 modInstrumentationSetCallback(SystemFreeMemory, modInstrumentationSystemFreeMemory);
282
283 modInstrumentationSetCallback(SlotHeapSize, (ModInstrumentationGetter)modInstrumentationSlotHeapSize);
284 modInstrumentationSetCallback(ChunkHeapSize, (ModInstrumentationGetter)modInstrumentationChunkHeapSize);
285 modInstrumentationSetCallback(KeysUsed, (ModInstrumentationGetter)modInstrumentationKeysUsed);
286 modInstrumentationSetCallback(GarbageCollectionCount, (ModInstrumentationGetter)modInstrumentationGarbageCollectionCount);
287 modInstrumentationSetCallback(ModulesLoaded, (ModInstrumentationGetter)modInstrumentationModulesLoaded);
288 modInstrumentationSetCallback(StackRemain, (ModInstrumentationGetter)modInstrumentationStackRemain);
289 modInstrumentationSetCallback(PromisesSettledCount, (ModInstrumentationGetter)modInstrumentationPromisesSettledCount);
290
291 gInstrumentMutex = xSemaphoreCreateMutex();
292
293#if INSTRUMENT_CPULOAD
294 modInstrumentationSetCallback(CPU0, modInstrumentationCPU0);
295
296 nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
297 nrf_drv_timer_init(&cpuTimer, &timer_cfg, cpuTimerHandler);
298 uint32_t ticks = nrf_drv_timer_us_to_ticks(&cpuTimer, CPUTIMER_US);
299 nrf_drv_timer_extended_compare(&cpuTimer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
300
301 gIdles[0] = xTaskGetIdleTaskHandle();
302
303 nrf_drv_timer_clear(&cpuTimer);
304 nrf_drv_timer_enable(&cpuTimer);
305#endif
306}
307
308extern SemaphoreHandle_t gDebugMutex;
309#include "semphr.h"

Callers 1

modInstrumentationSetupFunction · 0.70

Calls 1

modInstrumentationInitFunction · 0.85

Tested by

no test coverage detected