Change rb_gc_impl_get_measure_total_time to return a bool

This commit is contained in:
Peter Zhu 2024-09-17 10:55:42 -04:00
parent f826185786
commit 5df5eba465
Notes: git 2024-09-18 14:19:04 +00:00
4 changed files with 5 additions and 5 deletions

2
gc.c
View File

@ -635,7 +635,7 @@ typedef struct gc_function_map {
VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id); VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id);
// Statistics // Statistics
void (*set_measure_total_time)(void *objspace_ptr, VALUE flag); void (*set_measure_total_time)(void *objspace_ptr, VALUE flag);
VALUE (*get_measure_total_time)(void *objspace_ptr); bool (*get_measure_total_time)(void *objspace_ptr);
unsigned long long (*get_total_time)(void *objspace_ptr); unsigned long long (*get_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);

2
gc.rb
View File

@ -343,7 +343,7 @@ module GC
# Note that measurement can affect the application performance. # Note that measurement can affect the application performance.
def self.measure_total_time def self.measure_total_time
Primitive.cexpr! %{ Primitive.cexpr! %{
rb_gc_impl_get_measure_total_time(rb_gc_get_objspace()) RBOOL(rb_gc_impl_get_measure_total_time(rb_gc_get_objspace()))
} }
end end

View File

@ -1541,12 +1541,12 @@ rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag)
objspace->flags.measure_gc = RTEST(flag) ? TRUE : FALSE; objspace->flags.measure_gc = RTEST(flag) ? TRUE : FALSE;
} }
VALUE bool
rb_gc_impl_get_measure_total_time(void *objspace_ptr) rb_gc_impl_get_measure_total_time(void *objspace_ptr)
{ {
rb_objspace_t *objspace = objspace_ptr; rb_objspace_t *objspace = objspace_ptr;
return objspace->flags.measure_gc ? Qtrue : Qfalse; return objspace->flags.measure_gc;
} }
static size_t static size_t

View File

@ -86,7 +86,7 @@ GC_IMPL_FN VALUE rb_gc_impl_object_id(void *objspace_ptr, VALUE obj);
GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id); GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id);
// Statistics // Statistics
GC_IMPL_FN void rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag); GC_IMPL_FN void 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 bool rb_gc_impl_get_measure_total_time(void *objspace_ptr);
GC_IMPL_FN unsigned long long rb_gc_impl_get_total_time(void *objspace_ptr); GC_IMPL_FN unsigned long long rb_gc_impl_get_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);