Skip to content

Add patch to show GC timing usage. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions qafooprofiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ typedef struct hp_entry_t {
uint8 hash_code; /* hash_code for the function name */
zend_uint gc_runs; /* number of garbage collection runs */
zend_uint gc_collected; /* number of collected items in garbage run */
double gc_duration;
} hp_entry_t;

/* Various types for QAFOOPROFILER callbacks */
Expand Down Expand Up @@ -2367,8 +2368,10 @@ void hp_mode_hier_beginfn_cb(hp_entry_t **entries, hp_entry_t *current TSRMLS_DC
{
/* Get start tsc counter */
current->tsc_start = cycle_timer();

current->gc_runs = GC_G(gc_runs);
current->gc_collected = GC_G(collected);
current->gc_duration = GC_G(duration);

/* Get CPU usage */
if (hp_globals.qafooprofiler_flags & QAFOOPROFILER_FLAGS_CPU) {
Expand Down Expand Up @@ -2429,6 +2432,7 @@ zval * hp_mode_shared_endfn_cb(hp_entry_t *top, char *symbol TSRMLS_DC)
if ((GC_G(gc_runs) - top->gc_runs) > 0) {
hp_inc_count(counts, "gc", GC_G(gc_runs) - top->gc_runs TSRMLS_CC);
hp_inc_count(counts, "gcc", GC_G(collected) - top->gc_collected TSRMLS_CC);
hp_inc_count(counts, "gct", GC_G(duration) - top->gc_duration TSRMLS_CC);
}

if (hp_globals.layers_definition) {
Expand Down