diff options
author | Armin Rigo <arigo@tunes.org> | 2005-12-06 14:07:39 (GMT) |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2005-12-06 14:07:39 (GMT) |
commit | de5f05f3b1ce9f899c65d17f1097270ca66c200a (patch) | |
tree | 608983a04a31d52a55fd2c47fbe3bb53f7a0ece7 /Modules | |
parent | 28b32ac6bc23b8bc2b7bb37bdd199cf550ab7737 (diff) | |
download | cpython-de5f05f3b1ce9f899c65d17f1097270ca66c200a.zip cpython-de5f05f3b1ce9f899c65d17f1097270ca66c200a.tar.gz cpython-de5f05f3b1ce9f899c65d17f1097270ca66c200a.tar.bz2 |
Nobody on python-dev seemed particularly bothered that Hotshot generates half-
meaningless numbers, but I figured out I would fix that bug anyway.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hotshot.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index ddfd336..5e4a9f7 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -844,38 +844,6 @@ get_tdelta(ProfilerObject *self) /* The workhorse: the profiler callback function. */ static int -profiler_callback(ProfilerObject *self, PyFrameObject *frame, int what, - PyObject *arg) -{ - int tdelta = -1; - int fileno; - - if (self->frametimings) - tdelta = get_tdelta(self); - switch (what) { - case PyTrace_CALL: - fileno = get_fileno(self, frame->f_code); - if (fileno < 0) - return -1; - if (pack_enter(self, fileno, tdelta, - frame->f_code->co_firstlineno) < 0) - return -1; - break; - case PyTrace_RETURN: - if (pack_exit(self, tdelta) < 0) - return -1; - break; - default: - /* should never get here */ - break; - } - return 0; -} - - -/* Alternate callback when we want PyTrace_LINE events */ - -static int tracer_callback(ProfilerObject *self, PyFrameObject *frame, int what, PyObject *arg) { @@ -893,7 +861,7 @@ tracer_callback(ProfilerObject *self, PyFrameObject *frame, int what, case PyTrace_RETURN: return pack_exit(self, get_tdelta(self)); - case PyTrace_LINE: + case PyTrace_LINE: /* we only get these events if we asked for them */ if (self->linetimings) return pack_lineno_tdelta(self, frame->f_lineno, get_tdelta(self)); @@ -987,7 +955,7 @@ do_start(ProfilerObject *self) if (self->lineevents) PyEval_SetTrace((Py_tracefunc) tracer_callback, (PyObject *)self); else - PyEval_SetProfile((Py_tracefunc) profiler_callback, (PyObject *)self); + PyEval_SetProfile((Py_tracefunc) tracer_callback, (PyObject *)self); } static void |