From 4b142e67a4b2110722b9e82df5eee35d104799fb Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Tue, 14 Jun 2022 14:40:26 +0100 Subject: [PATCH 1/7] Allow stats recording to be turned on or off. WIP. --- Include/internal/pycore_code.h | 16 ++++++++-------- Include/pystats.h | 12 +++++++----- Python/ceval.c | 10 +++++----- Python/specialize.c | 13 +++++++++---- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index c181543722f6e0..c84b64221a02a0 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -254,16 +254,16 @@ extern int _PyStaticCode_InternStrings(PyCodeObject *co); #ifdef Py_STATS -#define STAT_INC(opname, name) _py_stats.opcode_stats[opname].specialization.name++ -#define STAT_DEC(opname, name) _py_stats.opcode_stats[opname].specialization.name-- -#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[opname].execution_count++ -#define CALL_STAT_INC(name) _py_stats.call_stats.name++ -#define OBJECT_STAT_INC(name) _py_stats.object_stats.name++ +#define STAT_INC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name++; } while (0) +#define STAT_DEC(opname, name) do { if (_py_stats) _py_stats->opcode_stats[opname].specialization.name--; } while (0) +#define OPCODE_EXE_INC(opname) do { if (_py_stats) _py_stats->opcode_stats[opname].execution_count++; } while (0) +#define CALL_STAT_INC(name) do { if (_py_stats) _py_stats->call_stats.name++; } while (0) +#define OBJECT_STAT_INC(name) do { if (_py_stats) _py_stats->object_stats.name++; } while (0) #define OBJECT_STAT_INC_COND(name, cond) \ - do { if (cond) _py_stats.object_stats.name++; } while (0) -#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[name]++ + do { if (_py_stats && cond) _py_stats->object_stats.name++; } while (0) +#define EVAL_CALL_STAT_INC(name) do { if (_py_stats) _py_stats->call_stats.eval_calls[name]++; } while (0) #define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \ - do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[name]++; } while (0) + do { if (_py_stats && PyFunction_Check(callable)) _py_stats->call_stats.eval_calls[name]++; } while (0) // Used by the _opcode extension which is built as a shared library PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); diff --git a/Include/pystats.h b/Include/pystats.h index bea471bfc1de94..2f1173ec707b87 100644 --- a/Include/pystats.h +++ b/Include/pystats.h @@ -73,19 +73,21 @@ typedef struct _stats { ObjectStats object_stats; } PyStats; -PyAPI_DATA(PyStats) _py_stats; + +PyAPI_DATA(PyStats) _py_stats_struct; +PyAPI_DATA(PyStats *) _py_stats; extern void _Py_PrintSpecializationStats(int to_file); #ifdef _PY_INTERPRETER -#define _Py_INCREF_STAT_INC() _py_stats.object_stats.interpreter_increfs++ -#define _Py_DECREF_STAT_INC() _py_stats.object_stats.interpreter_decrefs++ +#define _Py_INCREF_STAT_INC() do { if (_py_stats) _py_stats->object_stats.interpreter_increfs++; } while (0) +#define _Py_DECREF_STAT_INC() do { if (_py_stats) _py_stats->object_stats.interpreter_decrefs++; } while (0) #else -#define _Py_INCREF_STAT_INC() _py_stats.object_stats.increfs++ -#define _Py_DECREF_STAT_INC() _py_stats.object_stats.decrefs++ +#define _Py_INCREF_STAT_INC() do { if (_py_stats) _py_stats->object_stats.increfs++; } while (0) +#define _Py_DECREF_STAT_INC() do { if (_py_stats) _py_stats->object_stats.decrefs++; } while (0) #endif diff --git a/Python/ceval.c b/Python/ceval.c index 341d1d23ad99ea..c5fef550e95b3f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1310,7 +1310,7 @@ eval_frame_handle_pending(PyThreadState *tstate) do { \ frame->prev_instr = next_instr++; \ OPCODE_EXE_INC(op); \ - _py_stats.opcode_stats[lastopcode].pair_count[op]++; \ + if (_py_stats) _py_stats->opcode_stats[lastopcode].pair_count[op]++; \ lastopcode = op; \ } while (0) #else @@ -4339,8 +4339,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int PyObject *iter = TOP(); #ifdef Py_STATS extern int _PySpecialization_ClassifyIterator(PyObject *); - _py_stats.opcode_stats[FOR_ITER].specialization.failure++; - _py_stats.opcode_stats[FOR_ITER].specialization.failure_kinds[_PySpecialization_ClassifyIterator(iter)]++; + if (_py_stats) _py_stats->opcode_stats[FOR_ITER].specialization.failure++; + if (_py_stats) _py_stats->opcode_stats[FOR_ITER].specialization.failure_kinds[_PySpecialization_ClassifyIterator(iter)]++; #endif PyObject *next = (*Py_TYPE(iter)->tp_iternext)(iter); if (next != NULL) { @@ -7744,7 +7744,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args) PyObject *l = PyList_New(257); if (l == NULL) return NULL; for (i = 0; i < 256; i++) { - PyObject *x = getarray(_py_stats.opcode_stats[i].pair_count); + PyObject *x = getarray(_py_stats_struct.opcode_stats[i].pair_count); if (x == NULL) { Py_DECREF(l); return NULL; @@ -7758,7 +7758,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args) } for (i = 0; i < 256; i++) { PyObject *x = PyLong_FromUnsignedLongLong( - _py_stats.opcode_stats[i].execution_count); + _py_stats_struct.opcode_stats[i].execution_count); if (x == NULL) { Py_DECREF(counts); Py_DECREF(l); diff --git a/Python/specialize.c b/Python/specialize.c index b1877841cdf730..78730474ce9c15 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -32,7 +32,8 @@ uint8_t _PyOpcode_Adaptive[256] = { Py_ssize_t _Py_QuickenedCount = 0; #ifdef Py_STATS -PyStats _py_stats = { 0 }; +PyStats _py_stats_struct = { 0 }; +PyStats *_py_stats = &_py_stats_struct; #define ADD_STAT_TO_DICT(res, field) \ do { \ @@ -92,7 +93,7 @@ add_stat_dict( int opcode, const char *name) { - SpecializationStats *stats = &_py_stats.opcode_stats[opcode].specialization; + SpecializationStats *stats = &_py_stats_struct.opcode_stats[opcode].specialization; PyObject *d = stats_to_dict(stats); if (d == NULL) { return -1; @@ -250,8 +251,12 @@ _Py_PrintSpecializationStats(int to_file) #ifdef Py_STATS -#define SPECIALIZATION_FAIL(opcode, kind) _py_stats.opcode_stats[opcode].specialization.failure_kinds[kind]++ - +#define SPECIALIZATION_FAIL(opcode, kind) \ +do { \ + if (_py_stats) { \ + _py_stats->opcode_stats[opcode].specialization.failure_kinds[kind]++; \ + } \ +} while (0) #endif #endif From daa5487a4dee22ed372c238b42c12fd279e36e1f Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 15 Jun 2022 10:27:48 +0100 Subject: [PATCH 2/7] Allow stats to be turned on and off, and be cleared. --- Include/pystats.h | 1 + Python/clinic/sysmodule.c.h | 80 ++++++++++++++++++++++++++++++++++++- Python/specialize.c | 6 +++ Python/sysmodule.c | 62 ++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+), 1 deletion(-) diff --git a/Include/pystats.h b/Include/pystats.h index 2f1173ec707b87..87e92aa4f05fa6 100644 --- a/Include/pystats.h +++ b/Include/pystats.h @@ -77,6 +77,7 @@ typedef struct _stats { PyAPI_DATA(PyStats) _py_stats_struct; PyAPI_DATA(PyStats *) _py_stats; +extern void _Py_StatsClear(void); extern void _Py_PrintSpecializationStats(int to_file); #ifdef _PY_INTERPRETER diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index 6ee3bb2a849aab..242f880a57e7d7 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -965,6 +965,72 @@ sys_is_finalizing(PyObject *module, PyObject *Py_UNUSED(ignored)) return sys_is_finalizing_impl(module); } +#if defined(Py_STATS) + +PyDoc_STRVAR(sys__stats_on__doc__, +"_stats_on($module, /)\n" +"--\n" +"\n" +"Turns on stats gathering (stats gathering is on by default)"); + +#define SYS__STATS_ON_METHODDEF \ + {"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__}, + +static PyObject * +sys__stats_on_impl(PyObject *module); + +static PyObject * +sys__stats_on(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__stats_on_impl(module); +} + +#endif /* defined(Py_STATS) */ + +#if defined(Py_STATS) + +PyDoc_STRVAR(sys__stats_off__doc__, +"_stats_off($module, /)\n" +"--\n" +"\n" +"Turns off stats gathering (stats gathering is on by default)"); + +#define SYS__STATS_OFF_METHODDEF \ + {"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__}, + +static PyObject * +sys__stats_off_impl(PyObject *module); + +static PyObject * +sys__stats_off(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__stats_off_impl(module); +} + +#endif /* defined(Py_STATS) */ + +#if defined(Py_STATS) + +PyDoc_STRVAR(sys__stats_clear__doc__, +"_stats_clear($module, /)\n" +"--\n" +"\n" +"Clears stats"); + +#define SYS__STATS_CLEAR_METHODDEF \ + {"_stats_clear", (PyCFunction)sys__stats_clear, METH_NOARGS, sys__stats_clear__doc__}, + +static PyObject * +sys__stats_clear_impl(PyObject *module); + +static PyObject * +sys__stats_clear(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__stats_clear_impl(module); +} + +#endif /* defined(Py_STATS) */ + #if defined(ANDROID_API_LEVEL) PyDoc_STRVAR(sys_getandroidapilevel__doc__, @@ -1011,7 +1077,19 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #define SYS_GETTOTALREFCOUNT_METHODDEF #endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */ +#ifndef SYS__STATS_ON_METHODDEF + #define SYS__STATS_ON_METHODDEF +#endif /* !defined(SYS__STATS_ON_METHODDEF) */ + +#ifndef SYS__STATS_OFF_METHODDEF + #define SYS__STATS_OFF_METHODDEF +#endif /* !defined(SYS__STATS_OFF_METHODDEF) */ + +#ifndef SYS__STATS_CLEAR_METHODDEF + #define SYS__STATS_CLEAR_METHODDEF +#endif /* !defined(SYS__STATS_CLEAR_METHODDEF) */ + #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=98efd34fd9b9b6ab input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fcca2f667fc0b0f0 input=a9049054013a1b77]*/ diff --git a/Python/specialize.c b/Python/specialize.c index 78730474ce9c15..ed6eb5233ba176 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -210,6 +210,12 @@ print_stats(FILE *out, PyStats *stats) { print_object_stats(out, &stats->object_stats); } +void +_Py_StatsClear(void) +{ + _Py_stat_struct = { 0 }; +} + void _Py_PrintSpecializationStats(int to_file) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b9cae15568d0f5..e8669c1b46e0ad 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1909,6 +1909,63 @@ sys_is_finalizing_impl(PyObject *module) return PyBool_FromLong(_Py_IsFinalizing()); } +#ifdef Py_STATS +/*[clinic input] +sys._stats_on + +Turns on stats gathering (stats gathering is on by default) +[clinic start generated code]*/ + +static PyObject * +sys__stats_on_impl(PyObject *module) +/*[clinic end generated code: output=aca53eafcbb4d9fe input=f4bef5763c4387b8]*/ + +static PyObject * +sys__stats_on(PyObject *module) +/*[clinic end generated code]*/ +{ + _py_stats = &_py_stats_struct; + Py_RETURN_NONE; +} + +/*[clinic input] +sys._stats_off + +Turns off stats gathering (stats gathering is on by default) +[clinic start generated code]*/ + +static PyObject * +sys__stats_off_impl(PyObject *module) +/*[clinic end generated code: output=1534c1ee63812214 input=ec6e593e39b12b4a]*/ + +static PyObject * +sys__stats_off(PyObject *module) +/*[clinic end generated code]*/ +{ + _py_stats = NULL; + Py_RETURN_NONE; +} + +/*[clinic input] +sys._stats_clear + +Clears stats +[clinic start generated code]*/ + +static PyObject * +sys__stats_clear_impl(PyObject *module) +/*[clinic end generated code: output=fb65a2525ee50604 input=0bd23b30a48f67ab]*/ + +static PyObject * +sys__stats_clear(PyObject *module) +/*[clinic end generated code]*/ +{ + _Py_StatsClear(); + Py_RETURN_NONE; +} + +#endif + #ifdef ANDROID_API_LEVEL /*[clinic input] sys.getandroidapilevel @@ -1978,6 +2035,11 @@ static PyMethodDef sys_methods[] = { SYS_GET_ASYNCGEN_HOOKS_METHODDEF SYS_GETANDROIDAPILEVEL_METHODDEF SYS_UNRAISABLEHOOK_METHODDEF +#ifdef Py_STATS + SYS__STATS_ON_METHODDEF + SYS__STATS_OFF_METHODDEF + SYS__STATS_CLEAR_METHODDEF +#endif {NULL, NULL} // sentinel }; From 6bc5fe2a9bfa79fb5fda1ed579c6ef2d49256f2b Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 2 Feb 2022 16:19:44 +0000 Subject: [PATCH 3/7] Turn on stats --- Include/Python.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Include/Python.h b/Include/Python.h index 52a7aac6ba6cb6..b72d8a8ec2a224 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -5,6 +5,8 @@ #ifndef Py_PYTHON_H #define Py_PYTHON_H +#define Py_STATS 1 + // Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { // Include Python header files From d6ce8e62f15065a8166468dc26c8545a41a4db15 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 15 Jun 2022 10:51:28 +0100 Subject: [PATCH 4/7] Fixups and add dump function. --- Python/clinic/sysmodule.c.h | 28 +++++++++++++++++++++++++++- Python/specialize.c | 7 +++++-- Python/sysmodule.c | 24 ++++++++++++++---------- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index 242f880a57e7d7..bcca3cf9ec6e17 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -1031,6 +1031,28 @@ sys__stats_clear(PyObject *module, PyObject *Py_UNUSED(ignored)) #endif /* defined(Py_STATS) */ +#if defined(Py_STATS) + +PyDoc_STRVAR(sys__stats_dump__doc__, +"_stats_dump($module, /)\n" +"--\n" +"\n" +"Dump stats to file, and clear current stats."); + +#define SYS__STATS_DUMP_METHODDEF \ + {"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__}, + +static PyObject * +sys__stats_dump_impl(PyObject *module); + +static PyObject * +sys__stats_dump(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return sys__stats_dump_impl(module); +} + +#endif /* defined(Py_STATS) */ + #if defined(ANDROID_API_LEVEL) PyDoc_STRVAR(sys_getandroidapilevel__doc__, @@ -1089,7 +1111,11 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #define SYS__STATS_CLEAR_METHODDEF #endif /* !defined(SYS__STATS_CLEAR_METHODDEF) */ +#ifndef SYS__STATS_DUMP_METHODDEF + #define SYS__STATS_DUMP_METHODDEF +#endif /* !defined(SYS__STATS_DUMP_METHODDEF) */ + #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=fcca2f667fc0b0f0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=90fd2f93225ab5ee input=a9049054013a1b77]*/ diff --git a/Python/specialize.c b/Python/specialize.c index ed6eb5233ba176..2e617318bc9e3c 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -213,12 +213,15 @@ print_stats(FILE *out, PyStats *stats) { void _Py_StatsClear(void) { - _Py_stat_struct = { 0 }; + _py_stats_struct = (PyStats) { 0 }; } void _Py_PrintSpecializationStats(int to_file) { + if (_py_stats == NULL) { + return; + } FILE *out = stderr; if (to_file) { /* Write to a file instead of stderr. */ @@ -249,7 +252,7 @@ _Py_PrintSpecializationStats(int to_file) else { fprintf(out, "Specialization stats:\n"); } - print_stats(out, &_py_stats); + print_stats(out, _py_stats); if (out != stderr) { fclose(out); } diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e8669c1b46e0ad..30f497a8a7b9dc 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1919,10 +1919,6 @@ Turns on stats gathering (stats gathering is on by default) static PyObject * sys__stats_on_impl(PyObject *module) /*[clinic end generated code: output=aca53eafcbb4d9fe input=f4bef5763c4387b8]*/ - -static PyObject * -sys__stats_on(PyObject *module) -/*[clinic end generated code]*/ { _py_stats = &_py_stats_struct; Py_RETURN_NONE; @@ -1937,10 +1933,6 @@ Turns off stats gathering (stats gathering is on by default) static PyObject * sys__stats_off_impl(PyObject *module) /*[clinic end generated code: output=1534c1ee63812214 input=ec6e593e39b12b4a]*/ - -static PyObject * -sys__stats_off(PyObject *module) -/*[clinic end generated code]*/ { _py_stats = NULL; Py_RETURN_NONE; @@ -1955,11 +1947,22 @@ Clears stats static PyObject * sys__stats_clear_impl(PyObject *module) /*[clinic end generated code: output=fb65a2525ee50604 input=0bd23b30a48f67ab]*/ +{ + _Py_StatsClear(); + Py_RETURN_NONE; +} + +/*[clinic input] +sys._stats_dump + +Dump stats to file, and clear current stats. +[clinic start generated code]*/ static PyObject * -sys__stats_clear(PyObject *module) -/*[clinic end generated code]*/ +sys__stats_dump_impl(PyObject *module) +/*[clinic end generated code: output=79f796fb2b4ddf05 input=b2e51dae2fe969b1]*/ { + _Py_PrintSpecializationStats(1); _Py_StatsClear(); Py_RETURN_NONE; } @@ -2039,6 +2042,7 @@ static PyMethodDef sys_methods[] = { SYS__STATS_ON_METHODDEF SYS__STATS_OFF_METHODDEF SYS__STATS_CLEAR_METHODDEF + SYS__STATS_DUMP_METHODDEF #endif {NULL, NULL} // sentinel }; From cc0f61ee94e692441cb1c2bd99279fb41c89b9c7 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 15 Jun 2022 11:01:20 +0100 Subject: [PATCH 5/7] Turn stats back off. --- Include/Python.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Include/Python.h b/Include/Python.h index b72d8a8ec2a224..52a7aac6ba6cb6 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -5,8 +5,6 @@ #ifndef Py_PYTHON_H #define Py_PYTHON_H -#define Py_STATS 1 - // Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { // Include Python header files From e301cda1220372a7a33e09990effae848da6eb2b Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 15 Jun 2022 11:16:42 +0100 Subject: [PATCH 6/7] Add news --- .../2022-06-15-11-16-13.gh-issue-93841.06zqX3.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-06-15-11-16-13.gh-issue-93841.06zqX3.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-06-15-11-16-13.gh-issue-93841.06zqX3.rst b/Misc/NEWS.d/next/Core and Builtins/2022-06-15-11-16-13.gh-issue-93841.06zqX3.rst new file mode 100644 index 00000000000000..179d3808e3b4d5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-06-15-11-16-13.gh-issue-93841.06zqX3.rst @@ -0,0 +1,3 @@ +When built with ``-enable-pystats``, ``sys._stats_on()``, +``sys._stats_off()``, ``sys._stats_clear()`` and ``sys._stats_dump()`` +functions have been added to enable gathering stats for parts of programs. From 4409aff259c3bd5aaf5e7fa3fb0ad9a5b4a154e0 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Wed, 15 Jun 2022 11:22:44 +0100 Subject: [PATCH 7/7] Tidy up doc strings. --- Python/clinic/sysmodule.c.h | 10 +++++----- Python/sysmodule.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h index bcca3cf9ec6e17..76b4cc5578263c 100644 --- a/Python/clinic/sysmodule.c.h +++ b/Python/clinic/sysmodule.c.h @@ -971,7 +971,7 @@ PyDoc_STRVAR(sys__stats_on__doc__, "_stats_on($module, /)\n" "--\n" "\n" -"Turns on stats gathering (stats gathering is on by default)"); +"Turns on stats gathering (stats gathering is on by default)."); #define SYS__STATS_ON_METHODDEF \ {"_stats_on", (PyCFunction)sys__stats_on, METH_NOARGS, sys__stats_on__doc__}, @@ -993,7 +993,7 @@ PyDoc_STRVAR(sys__stats_off__doc__, "_stats_off($module, /)\n" "--\n" "\n" -"Turns off stats gathering (stats gathering is on by default)"); +"Turns off stats gathering (stats gathering is on by default)."); #define SYS__STATS_OFF_METHODDEF \ {"_stats_off", (PyCFunction)sys__stats_off, METH_NOARGS, sys__stats_off__doc__}, @@ -1015,7 +1015,7 @@ PyDoc_STRVAR(sys__stats_clear__doc__, "_stats_clear($module, /)\n" "--\n" "\n" -"Clears stats"); +"Clears the stats."); #define SYS__STATS_CLEAR_METHODDEF \ {"_stats_clear", (PyCFunction)sys__stats_clear, METH_NOARGS, sys__stats_clear__doc__}, @@ -1037,7 +1037,7 @@ PyDoc_STRVAR(sys__stats_dump__doc__, "_stats_dump($module, /)\n" "--\n" "\n" -"Dump stats to file, and clear current stats."); +"Dump stats to file, and clears the stats."); #define SYS__STATS_DUMP_METHODDEF \ {"_stats_dump", (PyCFunction)sys__stats_dump, METH_NOARGS, sys__stats_dump__doc__}, @@ -1118,4 +1118,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored)) #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ -/*[clinic end generated code: output=90fd2f93225ab5ee input=a9049054013a1b77]*/ +/*[clinic end generated code: output=41122dae1bb7158c input=a9049054013a1b77]*/ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 30f497a8a7b9dc..4c79356197ae88 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1913,12 +1913,12 @@ sys_is_finalizing_impl(PyObject *module) /*[clinic input] sys._stats_on -Turns on stats gathering (stats gathering is on by default) +Turns on stats gathering (stats gathering is on by default). [clinic start generated code]*/ static PyObject * sys__stats_on_impl(PyObject *module) -/*[clinic end generated code: output=aca53eafcbb4d9fe input=f4bef5763c4387b8]*/ +/*[clinic end generated code: output=aca53eafcbb4d9fe input=8ddc6df94e484f3a]*/ { _py_stats = &_py_stats_struct; Py_RETURN_NONE; @@ -1927,12 +1927,12 @@ sys__stats_on_impl(PyObject *module) /*[clinic input] sys._stats_off -Turns off stats gathering (stats gathering is on by default) +Turns off stats gathering (stats gathering is on by default). [clinic start generated code]*/ static PyObject * sys__stats_off_impl(PyObject *module) -/*[clinic end generated code: output=1534c1ee63812214 input=ec6e593e39b12b4a]*/ +/*[clinic end generated code: output=1534c1ee63812214 input=b3e50e71ecf29f66]*/ { _py_stats = NULL; Py_RETURN_NONE; @@ -1941,12 +1941,12 @@ sys__stats_off_impl(PyObject *module) /*[clinic input] sys._stats_clear -Clears stats +Clears the stats. [clinic start generated code]*/ static PyObject * sys__stats_clear_impl(PyObject *module) -/*[clinic end generated code: output=fb65a2525ee50604 input=0bd23b30a48f67ab]*/ +/*[clinic end generated code: output=fb65a2525ee50604 input=3e03f2654f44da96]*/ { _Py_StatsClear(); Py_RETURN_NONE; @@ -1955,12 +1955,12 @@ sys__stats_clear_impl(PyObject *module) /*[clinic input] sys._stats_dump -Dump stats to file, and clear current stats. +Dump stats to file, and clears the stats. [clinic start generated code]*/ static PyObject * sys__stats_dump_impl(PyObject *module) -/*[clinic end generated code: output=79f796fb2b4ddf05 input=b2e51dae2fe969b1]*/ +/*[clinic end generated code: output=79f796fb2b4ddf05 input=92346f16d64f6f95]*/ { _Py_PrintSpecializationStats(1); _Py_StatsClear();