@@ -925,10 +925,11 @@ static int
925925move_legacy_finalizer_reachable (struct collection_state * state );
926926
927927#if WITH_GC_TIMING_STATS
928+ FILE * gc_log ;
928929static void
929930print_gc_times (GCState * gcstate )
930931{
931- fprintf (stderr , "gc times: runs %ld total %.3fs mark %.3fs max %ldus avg %ldus\n" ,
932+ fprintf (gc_log , "gc times: runs %ld total %.3fs mark %.3fs max %ldus avg %ldus\n" ,
932933 gcstate -> timing_state .gc_runs ,
933934 PyTime_AsSecondsDouble (gcstate -> timing_state .gc_total_time ),
934935 PyTime_AsSecondsDouble (gcstate -> timing_state .gc_mark_time ),
@@ -975,7 +976,8 @@ mark_stack_push(_PyObjectStack *stack, PyObject *op)
975976 }
976977 assert (!gc_is_alive (op ));
977978 gc_set_alive (op );
978- if (_PyObjectStack_Push (stack , Py_NewRef (op )) < 0 ) {
979+ //gc_maybe_merge_refcount(op);
980+ if (_PyObjectStack_Push (stack , op ) < 0 ) {
979981 return false;
980982 }
981983 return true;
@@ -1040,7 +1042,7 @@ deduce_unreachable_heap(PyInterpreterState *interp,
10401042 gc_visit_heaps (interp , & update_refs , & state -> base );
10411043
10421044 #if WITH_GC_TIMING_STATS
1043- fprintf (stderr , "gc alive %d immortal %d checked %d gc %d\n" , num_alive , num_immortal , num_checked , num_gc );
1045+ fprintf (gc_log , "gc alive %d immortal %d checked %d gc %d\n" , num_alive , num_immortal , num_checked , num_gc );
10441046 #endif
10451047
10461048#ifdef GC_DEBUG
@@ -1212,6 +1214,7 @@ _PyGC_Init(PyInterpreterState *interp)
12121214 }
12131215
12141216#if WITH_GC_TIMING_STATS
1217+ gc_log = fopen ("/tmp/gc_timing.log" , "a" );
12151218 //p2engine_init(&gcstate->timing_state.auto_all, gc_timing_quantiles);
12161219 p2engine_init (& gcstate -> timing_state .auto_full , gc_timing_quantiles );
12171220#endif
@@ -2130,13 +2133,14 @@ _PyGC_Fini(PyInterpreterState *interp)
21302133 #if 0 // no generations so all are full collections
21312134 for (int i = 0 ; i < QUANTILE_COUNT ; i ++ ) {
21322135 double result = p2engine_result (& gcstate -> timing_state .auto_all , gc_timing_quantiles [i ]);
2133- fprintf (stderr , "gc timing all Q%.0f: %.2f\n" , gc_timing_quantiles [i ]* 100 , result );
2136+ fprintf (gc_log , "gc timing all Q%.0f: %.2f\n" , gc_timing_quantiles [i ]* 100 , result );
21342137 }
21352138 #endif
21362139 for (int i = 0 ; i < QUANTILE_COUNT ; i ++ ) {
21372140 double result = p2engine_result (& gcstate -> timing_state .auto_full , gc_timing_quantiles [i ]);
2138- fprintf (stderr , "gc timing full Q%.0f: %.2f\n" , gc_timing_quantiles [i ]* 100 , result );
2141+ fprintf (gc_log , "gc timing full Q%.0f: %.2f\n" , gc_timing_quantiles [i ]* 100 , result );
21392142 }
2143+ fclose (gc_log );
21402144 #endif // WITH_GC_TIMING_STATS
21412145
21422146 /* We expect that none of this interpreters objects are shared
0 commit comments