comparison Python/sysmodule.c @ 32301:41c59d80bbc5 legacy-trunk

Patch #510695: Add TSC profiling for the VM.
author Martin v. Löwis <martin@v.loewis.de>
date Tue, 08 Jun 2004 08:17:44 +0000
parents 846b3ee7e106
children 748129e6e108
comparison
equal deleted inserted replaced
32300:c84fd6be5a14 32301:41c59d80bbc5
440 440
441 PyDoc_STRVAR(getcheckinterval_doc, 441 PyDoc_STRVAR(getcheckinterval_doc,
442 "getcheckinterval() -> current check interval; see setcheckinterval()." 442 "getcheckinterval() -> current check interval; see setcheckinterval()."
443 ); 443 );
444 444
445 #ifdef WITH_TSC
446 static PyObject *
447 sys_settscdump(PyObject *self, PyObject *args)
448 {
449 int bool;
450 PyThreadState *tstate = PyThreadState_Get();
451
452 if (!PyArg_ParseTuple(args, "i:settscdump", &bool))
453 return NULL;
454 if (bool)
455 tstate->interp->tscdump = 1;
456 else
457 tstate->interp->tscdump = 0;
458 Py_INCREF(Py_None);
459 return Py_None;
460
461 }
462
463 PyDoc_STRVAR(settscdump_doc,
464 "settscdump(bool)\n\
465 \n\
466 If true, tell the Python interpreter to dump VM measurements to\n\
467 stderr. If false, turn off dump. The measurements are based on the\n\
468 Pentium time-stamp counter."
469 );
470 #endif TSC
471
445 static PyObject * 472 static PyObject *
446 sys_setrecursionlimit(PyObject *self, PyObject *args) 473 sys_setrecursionlimit(PyObject *self, PyObject *args)
447 { 474 {
448 int new_limit; 475 int new_limit;
449 if (!PyArg_ParseTuple(args, "i:setrecursionlimit", &new_limit)) 476 if (!PyArg_ParseTuple(args, "i:setrecursionlimit", &new_limit))
741 setdlopenflags_doc}, 768 setdlopenflags_doc},
742 #endif 769 #endif
743 {"setprofile", sys_setprofile, METH_O, setprofile_doc}, 770 {"setprofile", sys_setprofile, METH_O, setprofile_doc},
744 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, 771 {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
745 setrecursionlimit_doc}, 772 setrecursionlimit_doc},
773 #ifdef WITH_TSC
774 {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc},
775 #endif
746 {"settrace", sys_settrace, METH_O, settrace_doc}, 776 {"settrace", sys_settrace, METH_O, settrace_doc},
747 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, 777 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
748 {NULL, NULL} /* sentinel */ 778 {NULL, NULL} /* sentinel */
749 }; 779 };
750 780