void MemoryInfo(void) { for (TBlockBucket *pBucket = s_BlockBucket; pBucket->nSize > 0; pBucket++) { LoggerWrite (LoggerGet (), "alloc", LogDebug, "malloc(%lu): %u blocks (max %u)", pBucket->nSize, pBucket->nCount, pBucket->nMaxCount); } #ifdef MEM_PAGE_ALLOC LoggerWrite (LoggerGet (), "alloc", LogDebug, "palloc: %u pages (max %u)", s_PageBucket.nCount, s_PageBucket.nMaxCount); #endif }
unsigned TimerStartKernelTimer (TTimer *pThis, unsigned nDelay, TKernelTimerHandler *pHandler, void *pParam, void *pContext) { assert (pThis != 0); EnterCritical (); unsigned hTimer; for (hTimer = 0; hTimer < KERNEL_TIMERS; hTimer++) { if (pThis->m_KernelTimer[hTimer].m_pHandler == 0) { break; } } if (hTimer >= KERNEL_TIMERS) { LeaveCritical (); LoggerWrite (LoggerGet (), "timer", LogPanic, "System limit of kernel timers exceeded"); return 0; } assert (pHandler != 0); pThis->m_KernelTimer[hTimer].m_pHandler = pHandler; pThis->m_KernelTimer[hTimer].m_nElapsesAt = pThis->m_nTicks+nDelay; pThis->m_KernelTimer[hTimer].m_pParam = pParam; pThis->m_KernelTimer[hTimer].m_pContext = pContext; LeaveCritical (); return hTimer+1; }
void LogWrite (const char *pSource, unsigned Severity, const char *pMessage, ...) { va_list var; va_start (var, pMessage); LoggerWriteV (LoggerGet (), pSource, (TLogSeverity) Severity, pMessage, var); va_end (var); }