Skip to content

Commit

Permalink
replace frame_buffer with a single top_frame for profiling frames
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jun 10, 2024
1 parent e72af0c commit 9cdd680
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ext/datadog_cov/datadog_cov.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct dd_cov_data

VALUE coverage;

VALUE *frame_buffer;
VALUE *top_frame;
uintptr_t last_filename_ptr;
};

Expand All @@ -40,7 +40,7 @@ static void dd_cov_free(void *ptr)
struct dd_cov_data *dd_cov_data = ptr;
xfree(dd_cov_data->root);
xfree(dd_cov_data->ignored_path);
xfree(dd_cov_data->frame_buffer);
xfree(dd_cov_data->top_frame);
xfree(dd_cov_data);
}

Expand Down Expand Up @@ -70,7 +70,7 @@ static VALUE dd_cov_allocate(VALUE klass)
dd_cov_data->ignored_path = NULL;
dd_cov_data->ignored_path_len = 0;
dd_cov_data->last_filename_ptr = 0;
dd_cov_data->frame_buffer = xcalloc(PROFILE_FRAMES_BUFFER_SIZE, sizeof(VALUE));
dd_cov_data->top_frame = xmalloc(sizeof(VALUE));

return obj;
}
Expand Down Expand Up @@ -121,15 +121,15 @@ static void dd_cov_update_coverage(rb_event_flag_t event, VALUE data, VALUE self
int captured_frames = rb_profile_frames(
0 /* stack starting depth */,
PROFILE_FRAMES_BUFFER_SIZE,
dd_cov_data->frame_buffer,
dd_cov_data->top_frame,
NULL);

if (captured_frames != PROFILE_FRAMES_BUFFER_SIZE)
{
return;
}

VALUE filename = rb_profile_frame_path(dd_cov_data->frame_buffer[0]);
VALUE filename = rb_profile_frame_path(dd_cov_data->top_frame);
if (filename == Qnil)
{
return;
Expand Down

0 comments on commit 9cdd680

Please sign in to comment.