mirror of
https://github.com/python/cpython
synced 2026-09-28 05:13:17 +03:00
A few minor tweaks to get stats working and compiling cleanly. (#117219)
Fixes a compilation error when configured with `--enable-pystats`, an array size issue, and an unused variable.
This commit is contained in:
parent
507896d97d
commit
23e4f80ce2
3 changed files with 5 additions and 8 deletions
|
|
@ -118,7 +118,7 @@ typedef struct _optimization_stats {
|
||||||
uint64_t recursive_call;
|
uint64_t recursive_call;
|
||||||
uint64_t low_confidence;
|
uint64_t low_confidence;
|
||||||
uint64_t executors_invalidated;
|
uint64_t executors_invalidated;
|
||||||
UOpStats opcode[MAX_UOP_ID];
|
UOpStats opcode[MAX_UOP_ID+1];
|
||||||
uint64_t unsupported_opcode[256];
|
uint64_t unsupported_opcode[256];
|
||||||
uint64_t trace_length_hist[_Py_UOP_HIST_SIZE];
|
uint64_t trace_length_hist[_Py_UOP_HIST_SIZE];
|
||||||
uint64_t trace_run_length_hist[_Py_UOP_HIST_SIZE];
|
uint64_t trace_run_length_hist[_Py_UOP_HIST_SIZE];
|
||||||
|
|
@ -128,7 +128,7 @@ typedef struct _optimization_stats {
|
||||||
uint64_t optimizer_failure_reason_no_memory;
|
uint64_t optimizer_failure_reason_no_memory;
|
||||||
uint64_t remove_globals_builtins_changed;
|
uint64_t remove_globals_builtins_changed;
|
||||||
uint64_t remove_globals_incorrect_keys;
|
uint64_t remove_globals_incorrect_keys;
|
||||||
uint64_t error_in_opcode[MAX_UOP_ID];
|
uint64_t error_in_opcode[MAX_UOP_ID+1];
|
||||||
} OptimizationStats;
|
} OptimizationStats;
|
||||||
|
|
||||||
typedef struct _rare_event_stats {
|
typedef struct _rare_event_stats {
|
||||||
|
|
|
||||||
|
|
@ -1285,7 +1285,6 @@ gc_collect_young(PyThreadState *tstate,
|
||||||
for (gc = GC_NEXT(young); gc != young; gc = GC_NEXT(gc)) {
|
for (gc = GC_NEXT(young); gc != young; gc = GC_NEXT(gc)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
GC_STAT_ADD(0, objects_queued, count);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1422,7 +1421,6 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
|
||||||
gc_set_old_space(gc, gcstate->visited_space);
|
gc_set_old_space(gc, gcstate->visited_space);
|
||||||
increment_size += expand_region_transitively_reachable(&increment, gc, gcstate);
|
increment_size += expand_region_transitively_reachable(&increment, gc, gcstate);
|
||||||
}
|
}
|
||||||
GC_STAT_ADD(1, objects_queued, region_size);
|
|
||||||
PyGC_Head survivors;
|
PyGC_Head survivors;
|
||||||
gc_list_init(&survivors);
|
gc_list_init(&survivors);
|
||||||
gc_collect_region(tstate, &increment, &survivors, UNTRACK_TUPLES, stats);
|
gc_collect_region(tstate, &increment, &survivors, UNTRACK_TUPLES, stats);
|
||||||
|
|
@ -1805,10 +1803,10 @@ _PyGC_Collect(PyThreadState *tstate, int generation, _PyGC_Reason reason)
|
||||||
_PyErr_SetRaisedException(tstate, exc);
|
_PyErr_SetRaisedException(tstate, exc);
|
||||||
GC_STAT_ADD(generation, objects_collected, stats.collected);
|
GC_STAT_ADD(generation, objects_collected, stats.collected);
|
||||||
#ifdef Py_STATS
|
#ifdef Py_STATS
|
||||||
if (_py_stats) {
|
if (_Py_stats) {
|
||||||
GC_STAT_ADD(generation, object_visits,
|
GC_STAT_ADD(generation, object_visits,
|
||||||
_py_stats->object_stats.object_visits);
|
_Py_stats->object_stats.object_visits);
|
||||||
_py_stats->object_stats.object_visits = 0;
|
_Py_stats->object_stats.object_visits = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
validate_old(gcstate);
|
validate_old(gcstate);
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,6 @@ print_optimization_stats(FILE *out, OptimizationStats *stats)
|
||||||
fprintf(out, "Optimizer remove globals builtins changed: %" PRIu64 "\n", stats->remove_globals_builtins_changed);
|
fprintf(out, "Optimizer remove globals builtins changed: %" PRIu64 "\n", stats->remove_globals_builtins_changed);
|
||||||
fprintf(out, "Optimizer remove globals incorrect keys: %" PRIu64 "\n", stats->remove_globals_incorrect_keys);
|
fprintf(out, "Optimizer remove globals incorrect keys: %" PRIu64 "\n", stats->remove_globals_incorrect_keys);
|
||||||
|
|
||||||
const char* const* names;
|
|
||||||
for (int i = 0; i <= MAX_UOP_ID; i++) {
|
for (int i = 0; i <= MAX_UOP_ID; i++) {
|
||||||
if (stats->opcode[i].execution_count) {
|
if (stats->opcode[i].execution_count) {
|
||||||
fprintf(out, "uops[%s].execution_count : %" PRIu64 "\n", _PyUOpName(i), stats->opcode[i].execution_count);
|
fprintf(out, "uops[%s].execution_count : %" PRIu64 "\n", _PyUOpName(i), stats->opcode[i].execution_count);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue