mirror of
https://github.com/python/cpython.git
synced 2025-10-21 06:02:21 +00:00
Patch #510695: Add TSC profiling for the VM.
This commit is contained in:
parent
d68d3ee3dd
commit
f30d60edbc
10 changed files with 243 additions and 3 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue