* gc.c: Improve documentation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-07-08 00:18:39 +00:00
parent ba64040e9a
commit 50b64ee7de
2 changed files with 56 additions and 25 deletions

View File

@ -1,3 +1,7 @@
Fri Jul 8 09:17:59 2011 Eric Hodel <drbrain@segment7.net>
* gc.c: Improve documentation
Thu Jul 7 23:35:31 2011 Narihiro Nakamura <authornari@gmail.com> Thu Jul 7 23:35:31 2011 Narihiro Nakamura <authornari@gmail.com>
* gc.c: change water_mark value that may call * gc.c: change water_mark value that may call

77
gc.c
View File

@ -574,12 +574,12 @@ gc_stress_get(VALUE self)
* call-seq: * call-seq:
* GC.stress = bool -> bool * GC.stress = bool -> bool
* *
* updates GC stress mode. * Updates the GC stress mode.
* *
* When GC.stress = true, GC is invoked for all GC opportunity: * When stress mode is enabled the GC is invoked at every GC opportunity:
* all memory and object allocation. * all memory and object allocations.
* *
* Since it makes Ruby very slow, it is only for debugging. * Enabling stress mode makes Ruby very slow, it is only for debugging.
*/ */
static VALUE static VALUE
@ -595,7 +595,7 @@ gc_stress_set(VALUE self, VALUE flag)
* call-seq: * call-seq:
* GC::Profiler.enable? -> true or false * GC::Profiler.enable? -> true or false
* *
* returns current status of GC profile mode. * The current status of GC profile mode.
*/ */
static VALUE static VALUE
@ -609,8 +609,7 @@ gc_profile_enable_get(VALUE self)
* call-seq: * call-seq:
* GC::Profiler.enable -> nil * GC::Profiler.enable -> nil
* *
* updates GC profile mode. * Starts the GC profiler.
* start profiler for GC.
* *
*/ */
@ -627,8 +626,7 @@ gc_profile_enable(void)
* call-seq: * call-seq:
* GC::Profiler.disable -> nil * GC::Profiler.disable -> nil
* *
* updates GC profile mode. * Stops the GC profiler.
* stop profiler for GC.
* *
*/ */
@ -645,7 +643,7 @@ gc_profile_disable(void)
* call-seq: * call-seq:
* GC::Profiler.clear -> nil * GC::Profiler.clear -> nil
* *
* clear before profile data. * Clears the GC profiler data.
* *
*/ */
@ -3317,15 +3315,24 @@ gc_count(VALUE self)
* call-seq: * call-seq:
* GC.stat -> Hash * GC.stat -> Hash
* *
* Return information about GC. * Returns a Hash containing information about the GC.
* *
* It returns the hash includes information about internal statistisc * The hash includes information about internal statistics about GC such as:
* about GC such as: {:count => 42, ...}
* *
* The contents of the returned hash is implementation defined. * {
* It may be changed in future. * :count => 18,
* :heap_used => 77,
* :heap_length => 77,
* :heap_increment => 0,
* :heap_live_num => 23287,
* :heap_free_num => 8115,
* :heap_final_num => 0,
* }
* *
* This method is not expected to work except C Ruby. * The contents of the hash are implementation defined and may be changed in
* the future.
*
* This method is only expected to work on C Ruby.
* *
*/ */
@ -3429,14 +3436,13 @@ gc_profile_record_get(void)
/* /*
* call-seq: * call-seq:
* GC::Profiler.result -> string * GC::Profiler.result -> String
* *
* Report profile data to string. * Returns a profile data report such as:
* *
* It returns a string as: * GC 1 invokes.
* GC 1 invokes. * Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms)
* Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms) * 1 0.012 159240 212940 10647 0.00000000000001530000
* 1 0.012 159240 212940 10647 0.00000000000001530000
*/ */
static VALUE static VALUE
@ -3494,8 +3500,9 @@ gc_profile_result(void)
/* /*
* call-seq: * call-seq:
* GC::Profiler.report * GC::Profiler.report
* GC::Profiler.report io
* *
* GC::Profiler.result display * Writes the GC::Profiler#result to <tt>$stdout</tt> or the given IO object.
* *
*/ */
@ -3519,7 +3526,7 @@ gc_profile_report(int argc, VALUE *argv, VALUE self)
* call-seq: * call-seq:
* GC::Profiler.total_time -> float * GC::Profiler.total_time -> float
* *
* return total time that GC used. (msec) * The total time used for garbage collection in milliseconds
*/ */
static VALUE static VALUE
@ -3537,11 +3544,31 @@ gc_profile_total_time(VALUE self)
return DBL2NUM(time); return DBL2NUM(time);
} }
/* Document-class: GC::Profiler
*
* The GC profiler provides access to information on GC runs including time,
* length and object space size.
*
* Example:
*
* GC::Profiler.enable
*
* require 'rdoc/rdoc'
*
* puts GC::Profiler.result
*
* GC::Profiler.disable
*
* See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations
*/
/* /*
* The <code>GC</code> module provides an interface to Ruby's mark and * The <code>GC</code> module provides an interface to Ruby's mark and
* sweep garbage collection mechanism. Some of the underlying methods * sweep garbage collection mechanism. Some of the underlying methods
* are also available via the <code>ObjectSpace</code> module. * are also available via the ObjectSpace module.
*
* You may obtain information about the operation of the GC through
* GC::Profiler.
*/ */
void void