diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-03 22:28:47 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-03 22:28:47 -0500 |
| commit | 04099ca4f3585eae83de43ca7a2da96625234029 (patch) | |
| tree | 41ff4c5ff47697b1085837180c9e22b1d9e66eab /coverage/ctracer/tracer.c | |
| parent | 0dfb8c8275918b8a31c75ab9e8f45828b9698036 (diff) | |
| download | python-coveragepy-04099ca4f3585eae83de43ca7a2da96625234029.tar.gz | |
Collecting continues after saving data. #79 #448
Diffstat (limited to 'coverage/ctracer/tracer.c')
| -rw-r--r-- | coverage/ctracer/tracer.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c index 619ccee..ee112d8 100644 --- a/coverage/ctracer/tracer.c +++ b/coverage/ctracer/tracer.c @@ -340,8 +340,8 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame) CFileDisposition * pdisp = NULL; - STATS( self->stats.calls++; ) + self->activity = TRUE; /* Grow the stack. */ if (CTracer_set_pdata_stack(self) < 0) { @@ -1034,7 +1034,25 @@ CTracer_stop(CTracer *self, PyObject *args_unused) } static PyObject * -CTracer_get_stats(CTracer *self) +CTracer_activity(CTracer *self, PyObject *args_unused) +{ + if (self->activity) { + Py_RETURN_TRUE; + } + else { + Py_RETURN_FALSE; + } +} + +static PyObject * +CTracer_reset_activity(CTracer *self, PyObject *args_unused) +{ + self->activity = FALSE; + Py_RETURN_NONE; +} + +static PyObject * +CTracer_get_stats(CTracer *self, PyObject *args_unused) { #if COLLECT_STATS return Py_BuildValue( @@ -1103,6 +1121,12 @@ CTracer_methods[] = { { "get_stats", (PyCFunction) CTracer_get_stats, METH_VARARGS, PyDoc_STR("Get statistics about the tracing") }, + { "activity", (PyCFunction) CTracer_activity, METH_VARARGS, + PyDoc_STR("Has there been any activity?") }, + + { "reset_activity", (PyCFunction) CTracer_reset_activity, METH_VARARGS, + PyDoc_STR("Reset the activity flag") }, + { NULL } }; |
