static void SelectStackByKey(ProfilerObject *pObj, void *key) { ProfilerStack *old = pObj->currentProfilerStack; ProfilerStack *stack; if (old) { if (old->header.key == key) return; old->t0 = pObj->currentTime; } stack = (ProfilerStack*)RotatingTree_Get(&pObj->profilerStacks, key); if (stack) { if (stack->currentProfilerContext) stack->currentProfilerContext->paused += pObj->currentTime - stack->t0; } else { stack = (ProfilerStack*) malloc(sizeof(ProfilerStack)); if (stack != NULL) { stack->currentProfilerContext = NULL; stack->header.key = key; RotatingTree_Add(&pObj->profilerStacks, (rotating_node_t*)stack); ++pObj->nProfilerStacks; } } pObj->currentProfilerStack = stack; }
static ProfilerSubEntry * getSubEntry(ProfilerObject *pObj, ProfilerEntry *caller, ProfilerEntry* entry) { return (ProfilerSubEntry*) RotatingTree_Get(&caller->calls, (void *)entry); }
static ProfilerEntry* getEntry(ProfilerObject *pObj, void *key) { return (ProfilerEntry*) RotatingTree_Get(&pObj->profilerEntries, key); }