mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (gc_profile_total_time): add GC::Profiler.total_time.
* NEWS: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e09838c691
commit
4d8d6d9d63
3 changed files with 33 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Mar 4 13:14:34 2010 wanabe <s.wanabe@gmail.com>
|
||||
|
||||
* gc.c (gc_profile_total_time): add GC::Profiler.total_time.
|
||||
|
||||
* NEWS: ditto.
|
||||
|
||||
Thu Mar 4 10:15:10 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* complex.c (m_log, m_exp): remove unused functions.
|
||||
|
|
4
NEWS
4
NEWS
|
@ -69,6 +69,10 @@ with all sufficient information, see the ChangeLog file.
|
|||
* File.realpath
|
||||
* File.realdirpath
|
||||
|
||||
* GC::Profiler
|
||||
* new method:
|
||||
* GC::Profiler.total_time
|
||||
|
||||
* IO
|
||||
* new method:
|
||||
* IO#fdatasync
|
||||
|
|
23
gc.c
23
gc.c
|
@ -3128,6 +3128,28 @@ gc_profile_report(int argc, VALUE *argv, VALUE self)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* GC::Profiler.total_time -> float
|
||||
*
|
||||
* return total time that GC used. (msec)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
gc_profile_total_time(VALUE self)
|
||||
{
|
||||
double time = 0;
|
||||
rb_objspace_t *objspace = &rb_objspace;
|
||||
size_t i;
|
||||
|
||||
if (objspace->profile.run && objspace->profile.count) {
|
||||
for (i = 0; i < objspace->profile.count; i++) {
|
||||
time += objspace->profile.record[i].gc_time;
|
||||
}
|
||||
}
|
||||
return DBL2NUM(time);
|
||||
}
|
||||
|
||||
/*
|
||||
* The <code>GC</code> module provides an interface to Ruby's mark and
|
||||
* sweep garbage collection mechanism. Some of the underlying methods
|
||||
|
@ -3156,6 +3178,7 @@ Init_GC(void)
|
|||
rb_define_singleton_method(rb_mProfiler, "clear", gc_profile_clear, 0);
|
||||
rb_define_singleton_method(rb_mProfiler, "result", gc_profile_result, 0);
|
||||
rb_define_singleton_method(rb_mProfiler, "report", gc_profile_report, -1);
|
||||
rb_define_singleton_method(rb_mProfiler, "total_time", gc_profile_total_time, 0);
|
||||
|
||||
rb_mObSpace = rb_define_module("ObjectSpace");
|
||||
rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1);
|
||||
|
|
Loading…
Reference in a new issue