From c9d2c0ac109e93c241c6fe52d1923a4f6a3ad331 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Mon, 7 Jan 2013 02:13:45 -0800 Subject: [PATCH] Get pause/resume tests passing. --- ext/ruby_prof/rp_stack.c | 2 +- ext/ruby_prof/rp_thread.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/ruby_prof/rp_stack.c b/ext/ruby_prof/rp_stack.c index 70978f48..09f6a1a3 100644 --- a/ext/ruby_prof/rp_stack.c +++ b/ext/ruby_prof/rp_stack.c @@ -100,7 +100,7 @@ prof_stack_pop(prof_stack_t *stack, double measurement) frame = --stack->ptr; /* Calculate the total time this method took */ - //prof_frame_unpause(frame, measurement); + prof_frame_unpause(frame, measurement); total_time = measurement - frame->start_time - frame->dead_time; self_time = total_time - frame->child_time - frame->wait_time; diff --git a/ext/ruby_prof/rp_thread.c b/ext/ruby_prof/rp_thread.c index a37b9e73..8e371f51 100644 --- a/ext/ruby_prof/rp_thread.c +++ b/ext/ruby_prof/rp_thread.c @@ -179,14 +179,13 @@ switch_thread(void* prof, VALUE thread_id) return thread_data; } - int pause_thread(st_data_t key, st_data_t value, st_data_t data) { thread_data_t* thread_data = (thread_data_t *) value; - double measurement = (double) data; + prof_profile_t* profile = (prof_profile_t*)data; prof_frame_t* frame = prof_stack_peek(thread_data->stack); - prof_frame_pause(frame, measurement); + prof_frame_pause(frame, profile->measurement_at_pause_resume); return ST_CONTINUE; } @@ -194,10 +193,10 @@ int pause_thread(st_data_t key, st_data_t value, st_data_t data) int unpause_thread(st_data_t key, st_data_t value, st_data_t data) { thread_data_t* thread_data = (thread_data_t *) value; - double measurement = (double) data; + prof_profile_t* profile = (prof_profile_t*)data; prof_frame_t* frame = prof_stack_peek(thread_data->stack); - prof_frame_unpause(frame, measurement); + prof_frame_unpause(frame, profile->measurement_at_pause_resume); return ST_CONTINUE; }