Fix GC_BENCH flag (#10823)

zend_gc_globals is now hidden, so we can't access it from zend.c.
This commit is contained in:
Ilija Tovilo 2023-03-10 15:02:22 +01:00 committed by GitHub
parent 69ec3c6bc6
commit 6f1e5ff8c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 10 deletions

View File

@ -1310,16 +1310,7 @@ ZEND_API void zend_deactivate(void) /* {{{ */
}
#if GC_BENCH
fprintf(stderr, "GC Statistics\n");
fprintf(stderr, "-------------\n");
fprintf(stderr, "Runs: %d\n", GC_G(gc_runs));
fprintf(stderr, "Collected: %d\n", GC_G(collected));
fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length));
fprintf(stderr, "Root buffer peak: %d\n\n", GC_G(root_buf_peak));
fprintf(stderr, " Possible Remove from Marked\n");
fprintf(stderr, " Root Buffered buffer grey\n");
fprintf(stderr, " -------- -------- ----------- ------\n");
fprintf(stderr, "ZVAL %8d %8d %9d %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove_from_buffer), GC_G(zval_marked_grey));
gc_bench_print();
#endif
}
/* }}} */

View File

@ -1741,6 +1741,22 @@ static void zend_gc_root_tmpvars(void) {
}
}
#if GC_BENCH
void gc_bench_print(void)
{
fprintf(stderr, "GC Statistics\n");
fprintf(stderr, "-------------\n");
fprintf(stderr, "Runs: %d\n", GC_G(gc_runs));
fprintf(stderr, "Collected: %d\n", GC_G(collected));
fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length));
fprintf(stderr, "Root buffer peak: %d\n\n", GC_G(root_buf_peak));
fprintf(stderr, " Possible Remove from Marked\n");
fprintf(stderr, " Root Buffered buffer grey\n");
fprintf(stderr, " -------- -------- ----------- ------\n");
fprintf(stderr, "ZVAL %8d %8d %9d %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove_from_buffer), GC_G(zval_marked_grey));
}
#endif
#ifdef ZTS
size_t zend_gc_globals_size(void)
{

View File

@ -46,6 +46,10 @@ ZEND_API bool gc_enabled(void);
ZEND_API bool gc_protect(bool protect);
ZEND_API bool gc_protected(void);
#if GC_BENCH
void gc_bench_print(void);
#endif
/* The default implementation of the gc_collect_cycles callback. */
ZEND_API int zend_gc_collect_cycles(void);