diff --git a/gc.c b/gc.c index ee8b7bc376..f47f82e26b 100644 --- a/gc.c +++ b/gc.c @@ -636,7 +636,7 @@ typedef struct gc_function_map { // Statistics VALUE (*set_measure_total_time)(void *objspace_ptr, VALUE flag); VALUE (*get_measure_total_time)(void *objspace_ptr); - VALUE (*get_profile_total_time)(void *objspace_ptr); + unsigned long long (*get_profile_total_time)(void *objspace_ptr); size_t (*gc_count)(void *objspace_ptr); VALUE (*latest_gc_info)(void *objspace_ptr, VALUE key); size_t (*stat)(void *objspace_ptr, VALUE hash_or_sym); diff --git a/gc.rb b/gc.rb index f714fba749..7b943f1d80 100644 --- a/gc.rb +++ b/gc.rb @@ -352,7 +352,7 @@ module GC # Return measured \GC total time in nano seconds. def self.total_time Primitive.cexpr! %{ - rb_gc_impl_get_profile_total_time(rb_gc_get_objspace()) + ULL2NUM(rb_gc_impl_get_profile_total_time(rb_gc_get_objspace())) } end end diff --git a/gc/default.c b/gc/default.c index d959e108ab..149eae5971 100644 --- a/gc/default.c +++ b/gc/default.c @@ -1522,7 +1522,7 @@ rb_gc_impl_set_event_hook(void *objspace_ptr, const rb_event_flag_t event) objspace->flags.has_newobj_hook = !!(objspace->hook_events & RUBY_INTERNAL_EVENT_NEWOBJ); } -VALUE +unsigned long long rb_gc_impl_get_profile_total_time(void *objspace_ptr) { rb_objspace_t *objspace = objspace_ptr; @@ -1530,7 +1530,7 @@ rb_gc_impl_get_profile_total_time(void *objspace_ptr) unsigned long long marking_time = objspace->profile.marking_time_ns; unsigned long long sweeping_time = objspace->profile.sweeping_time_ns; - return ULL2NUM(marking_time + sweeping_time); + return marking_time + sweeping_time; } VALUE diff --git a/gc/gc_impl.h b/gc/gc_impl.h index 12527845f7..ec47c9fe7e 100644 --- a/gc/gc_impl.h +++ b/gc/gc_impl.h @@ -87,7 +87,7 @@ GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id // Statistics GC_IMPL_FN VALUE rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag); GC_IMPL_FN VALUE rb_gc_impl_get_measure_total_time(void *objspace_ptr); -GC_IMPL_FN VALUE rb_gc_impl_get_profile_total_time(void *objspace_ptr); +GC_IMPL_FN unsigned long long rb_gc_impl_get_profile_total_time(void *objspace_ptr); GC_IMPL_FN size_t rb_gc_impl_gc_count(void *objspace_ptr); GC_IMPL_FN VALUE rb_gc_impl_latest_gc_info(void *objspace_ptr, VALUE key); GC_IMPL_FN size_t rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym);