Change rb_gc_impl_get_profile_total_time to return unsigned long long

This commit is contained in:
Peter Zhu 2024-09-17 11:39:43 -04:00
parent 5de7517bcb
commit 2af080bd30
Notes: git 2024-09-17 19:23:00 +00:00
4 changed files with 5 additions and 5 deletions

2
gc.c
View File

@ -636,7 +636,7 @@ typedef struct gc_function_map {
// Statistics // Statistics
VALUE (*set_measure_total_time)(void *objspace_ptr, VALUE flag); VALUE (*set_measure_total_time)(void *objspace_ptr, VALUE flag);
VALUE (*get_measure_total_time)(void *objspace_ptr); 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); size_t (*gc_count)(void *objspace_ptr);
VALUE (*latest_gc_info)(void *objspace_ptr, VALUE key); VALUE (*latest_gc_info)(void *objspace_ptr, VALUE key);
size_t (*stat)(void *objspace_ptr, VALUE hash_or_sym); size_t (*stat)(void *objspace_ptr, VALUE hash_or_sym);

2
gc.rb
View File

@ -352,7 +352,7 @@ module GC
# Return measured \GC total time in nano seconds. # Return measured \GC total time in nano seconds.
def self.total_time def self.total_time
Primitive.cexpr! %{ 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
end end

View File

@ -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); 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_gc_impl_get_profile_total_time(void *objspace_ptr)
{ {
rb_objspace_t *objspace = 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 marking_time = objspace->profile.marking_time_ns;
unsigned long long sweeping_time = objspace->profile.sweeping_time_ns; unsigned long long sweeping_time = objspace->profile.sweeping_time_ns;
return ULL2NUM(marking_time + sweeping_time); return marking_time + sweeping_time;
} }
VALUE VALUE

View File

@ -87,7 +87,7 @@ GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id
// Statistics // Statistics
GC_IMPL_FN VALUE rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag); 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_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 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 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); GC_IMPL_FN size_t rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym);