Patch #510695: Add TSC profiling for the VM.

This commit is contained in:
Martin v. Löwis 2004-06-08 08:17:44 +00:00
parent d68d3ee3dd
commit f30d60edbc
10 changed files with 243 additions and 3 deletions

View file

@ -442,6 +442,33 @@ PyDoc_STRVAR(getcheckinterval_doc,
"getcheckinterval() -> current check interval; see setcheckinterval()."
);
#ifdef WITH_TSC
static PyObject *
sys_settscdump(PyObject *self, PyObject *args)
{
int bool;
PyThreadState *tstate = PyThreadState_Get();
if (!PyArg_ParseTuple(args, "i:settscdump", &bool))
return NULL;
if (bool)
tstate->interp->tscdump = 1;
else
tstate->interp->tscdump = 0;
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(settscdump_doc,
"settscdump(bool)\n\
\n\
If true, tell the Python interpreter to dump VM measurements to\n\
stderr. If false, turn off dump. The measurements are based on the\n\
Pentium time-stamp counter."
);
#endif TSC
static PyObject *
sys_setrecursionlimit(PyObject *self, PyObject *args)
{
@ -743,6 +770,9 @@ static PyMethodDef sys_methods[] = {
{"setprofile", sys_setprofile, METH_O, setprofile_doc},
{"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
setrecursionlimit_doc},
#ifdef WITH_TSC
{"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc},
#endif
{"settrace", sys_settrace, METH_O, settrace_doc},
{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
{NULL, NULL} /* sentinel */