Lines Matching refs:pObj
130 static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj) in CallExternalTimer() argument
133 PyObject *o = PyObject_Call(pObj->externalTimer, empty_tuple, NULL); in CallExternalTimer()
135 PyErr_WriteUnraisable(pObj->externalTimer); in CallExternalTimer()
138 if (pObj->externalTimerUnit > 0.0) { in CallExternalTimer()
153 PyErr_WriteUnraisable(pObj->externalTimer); in CallExternalTimer()
159 #define CALL_TIMER(pObj) ((pObj)->externalTimer ? \ argument
160 CallExternalTimer(pObj) : \
227 newProfilerEntry(ProfilerObject *pObj, void *key, PyObject *userObj) in newProfilerEntry() argument
232 pObj->flags |= POF_NOMEMORY; in newProfilerEntry()
239 pObj->flags |= POF_NOMEMORY; in newProfilerEntry()
250 RotatingTree_Add(&pObj->profilerEntries, &self->header); in newProfilerEntry()
255 getEntry(ProfilerObject *pObj, void *key) in getEntry() argument
257 return (ProfilerEntry*) RotatingTree_Get(&pObj->profilerEntries, key); in getEntry()
261 getSubEntry(ProfilerObject *pObj, ProfilerEntry *caller, ProfilerEntry* entry) in getSubEntry() argument
268 newSubEntry(ProfilerObject *pObj, ProfilerEntry *caller, ProfilerEntry* entry) in newSubEntry() argument
273 pObj->flags |= POF_NOMEMORY; in newSubEntry()
302 static void clearEntries(ProfilerObject *pObj) in clearEntries() argument
304 RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL); in clearEntries()
305 pObj->profilerEntries = EMPTY_ROTATING_TREE; in clearEntries()
307 if (pObj->currentProfilerContext) { in clearEntries()
308 free(pObj->currentProfilerContext); in clearEntries()
309 pObj->currentProfilerContext = NULL; in clearEntries()
311 while (pObj->freelistProfilerContext) { in clearEntries()
312 ProfilerContext *c = pObj->freelistProfilerContext; in clearEntries()
313 pObj->freelistProfilerContext = c->previous; in clearEntries()
316 pObj->freelistProfilerContext = NULL; in clearEntries()
320 initContext(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) in initContext() argument
324 self->previous = pObj->currentProfilerContext; in initContext()
325 pObj->currentProfilerContext = self; in initContext()
327 if ((pObj->flags & POF_SUBCALLS) && self->previous) { in initContext()
330 ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry); in initContext()
332 subentry = newSubEntry(pObj, caller, entry); in initContext()
336 self->t0 = CALL_TIMER(pObj); in initContext()
340 Stop(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) in Stop() argument
342 PY_LONG_LONG tt = CALL_TIMER(pObj) - self->t0; in Stop()
346 pObj->currentProfilerContext = self->previous; in Stop()
353 if ((pObj->flags & POF_SUBCALLS) && self->previous) { in Stop()
356 ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry); in Stop()
373 ProfilerObject *pObj = (ProfilerObject*)self; in ptrace_enter_call() local
386 profEntry = getEntry(pObj, key); in ptrace_enter_call()
388 profEntry = newProfilerEntry(pObj, key, userObj); in ptrace_enter_call()
393 pContext = pObj->freelistProfilerContext; in ptrace_enter_call()
395 pObj->freelistProfilerContext = pContext->previous; in ptrace_enter_call()
402 pObj->flags |= POF_NOMEMORY; in ptrace_enter_call()
406 initContext(pObj, pContext, profEntry); in ptrace_enter_call()
416 ProfilerObject *pObj = (ProfilerObject*)self; in ptrace_leave_call() local
420 pContext = pObj->currentProfilerContext; in ptrace_leave_call()
423 profEntry = getEntry(pObj, key); in ptrace_leave_call()
425 Stop(pObj, pContext, profEntry); in ptrace_leave_call()
428 pObj->currentProfilerContext = pContext->previous; in ptrace_leave_call()
431 pContext->previous = pObj->freelistProfilerContext; in ptrace_leave_call()
432 pObj->freelistProfilerContext = pContext; in ptrace_leave_call()
489 pending_exception(ProfilerObject *pObj) in pending_exception() argument
491 if (pObj->flags & POF_NOMEMORY) { in pending_exception()
492 pObj->flags -= POF_NOMEMORY; in pending_exception()
632 profiler_getstats(ProfilerObject *pObj, PyObject* noarg) in profiler_getstats() argument
635 if (pending_exception(pObj)) in profiler_getstats()
637 if (!pObj->externalTimer) in profiler_getstats()
639 else if (pObj->externalTimerUnit > 0.0) in profiler_getstats()
640 collect.factor = pObj->externalTimerUnit; in profiler_getstats()
646 if (RotatingTree_Enum(pObj->profilerEntries, statsForEntry, &collect) in profiler_getstats()
655 setSubcalls(ProfilerObject *pObj, int nvalue) in setSubcalls() argument
658 pObj->flags &= ~POF_SUBCALLS; in setSubcalls()
660 pObj->flags |= POF_SUBCALLS; in setSubcalls()
665 setBuiltins(ProfilerObject *pObj, int nvalue) in setBuiltins() argument
668 pObj->flags &= ~POF_BUILTINS; in setBuiltins()
675 pObj->flags |= POF_BUILTINS; in setBuiltins()
709 flush_unmatched(ProfilerObject *pObj) in flush_unmatched() argument
711 while (pObj->currentProfilerContext) { in flush_unmatched()
712 ProfilerContext *pContext = pObj->currentProfilerContext; in flush_unmatched()
715 Stop(pObj, pContext, profEntry); in flush_unmatched()
717 pObj->currentProfilerContext = pContext->previous; in flush_unmatched()
749 profiler_clear(ProfilerObject *pObj, PyObject* noarg) in profiler_clear() argument
751 clearEntries(pObj); in profiler_clear()
768 profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw) in profiler_init() argument
787 if (setSubcalls(pObj, subcalls) < 0 || setBuiltins(pObj, builtins) < 0) in profiler_init()
789 o = pObj->externalTimer; in profiler_init()
790 pObj->externalTimer = timer; in profiler_init()
793 pObj->externalTimerUnit = timeunit; in profiler_init()