Esempio n. 1
0
static void
initContext(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry)
{
	self->ctxEntry = entry;
	self->subt = 0;
	self->previous = pObj->currentProfilerContext;
	pObj->currentProfilerContext = self;
	++entry->recursionLevel;
	if ((pObj->flags & POF_SUBCALLS) && self->previous) {
		/* find or create an entry for me in my caller's entry */
		ProfilerEntry *caller = self->previous->ctxEntry;
		ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry);
		if (subentry == NULL)
			subentry = newSubEntry(pObj, caller, entry);
		if (subentry)
			++subentry->recursionLevel;
	}
	self->t0 = CALL_TIMER(pObj);
}
Esempio n. 2
0
static void
initContext(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry)
{
    long subcallRecursionLevel = 0;
    self->ctxEntry = entry;
    self->subt = self->paused = 0;
    self->previous = CURRENT_CONTEXT(pObj);
    CURRENT_CONTEXT(pObj) = self;
    ++entry->recursionLevel;
    if ((pObj->flags & POF_SUBCALLS) && self->previous) {
        /* find or create an entry for me in my caller's entry */
        ProfilerEntry *caller = self->previous->ctxEntry;
        ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry);
        if (subentry == NULL)
            subentry = newSubEntry(pObj, caller, entry);
        if (subentry)
            subcallRecursionLevel = ++subentry->recursionLevel;
    }
    checkRecursion(self, pObj->nProfilerStacks, entry->recursionLevel,
                   subcallRecursionLevel);
    self->t0 = pObj->currentTime;
}