ext/ruby_prof.c
static VALUE
prof_set_measure_mode(VALUE self, VALUE val)
{
    long mode = NUM2LONG(val);

    if (threads_tbl)
    {
      rb_raise(rb_eRuntimeError, "can't set measure_mode while profiling");
    }

    switch (mode) {
      case MEASURE_PROCESS_TIME:
        get_measurement = measure_process_time;
        convert_measurement = convert_process_time;
        break;
        
      case MEASURE_WALL_TIME:
        get_measurement = measure_wall_time;
        convert_measurement = convert_wall_time;
        break;
        
      #if defined(MEASURE_CPU_TIME)
      case MEASURE_CPU_TIME:
        if (cpu_frequency == 0)
            cpu_frequency = measure_cpu_time();
        get_measurement = measure_cpu_time;
        convert_measurement = convert_cpu_time;
        break;
      #endif
              
      #if defined(MEASURE_ALLOCATIONS)
      case MEASURE_ALLOCATIONS:
        get_measurement = measure_allocations;
        convert_measurement = convert_allocations;
        break;
      #endif
        
      #if defined(MEASURE_MEMORY)
      case MEASURE_MEMORY:
        get_measurement = measure_memory;
        convert_measurement = convert_memory;
        break;
      #endif

      #if defined(MEASURE_GC_RUNS)
      case MEASURE_GC_RUNS:
        get_measurement = measure_gc_runs;
        convert_measurement = convert_gc_runs;
        break;
      #endif

      #if defined(MEASURE_GC_TIME)
      case MEASURE_GC_TIME:
        get_measurement = measure_gc_time;
        convert_measurement = convert_gc_time;
        break;
      #endif

      default:
        rb_raise(rb_eArgError, "invalid mode: %d", mode);
        break;
    }
    
    measure_mode = mode;
    return val;
}
/* call-seq:
   measure_mode=value -> void
   
   Specifies what ruby-prof should measure.  Valid values include:
   
   *RubyProf::PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
   *RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
   *RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms. 
   *RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
   *RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
   *RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
   *RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.*/
call-seq:
measure_mode=value -> void

Specifies what ruby-prof should measure.  Valid values include.

:PROCESS_TIME - Measure process time.  This is default.  It is implemented using the clock functions in the C Runtime library.
RubyProf::WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows
RubyProf::CPU_TIME - Measure time using the CPU clock counter.  This mode is only supported on Pentium or PowerPC platforms.
RubyProf::ALLOCATIONS - Measure object allocations.  This requires a patched Ruby interpreter.
RubyProf::MEMORY - Measure memory size.  This requires a patched Ruby interpreter.
RubyProf::GC_RUNS - Measure number of garbage collections.  This requires a patched Ruby interpreter.
RubyProf::GC_TIME - Measure time spent doing garbage collection.  This requires a patched Ruby interpreter.
call - seq : measure_mode = value - > void Specifies what ruby - prof should measure . Valid values include . : PROCESS_TIME - Measure process time . This is default . It is implemented using the clock functions in the C Runtime library . RubyProf :: WALL_TIME - Measure wall time using gettimeofday on Linx and GetLocalTime on Windows RubyProf :: CPU_TIME - Measure time using the CPU clock counter . This mode is only supported on Pentium or PowerPC platforms . RubyProf :: ALLOCATIONS - Measure object allocations . This requires a patched Ruby interpreter . RubyProf :: MEMORY - Measure memory size . This requires a patched Ruby interpreter . RubyProf :: GC_RUNS - Measure number of garbage collections . This requires a patched Ruby interpreter . RubyProf :: GC_TIME - Measure time spent doing garbage collection . This requires a patched Ruby interpreter .
static VALUE
prof_set_measure_mode(VALUE self, VALUE val)
{
    long mode = NUM2LONG(val);
    if (threads_tbl)
    {
      rb_raise(rb_eRuntimeError, "can't set measure_mode while profiling");
    }
    switch (mode) {
      case MEASURE_PROCESS_TIME:
        get_measurement = measure_process_time;
        convert_measurement = convert_process_time;
        break;
      case MEASURE_WALL_TIME:
        get_measurement = measure_wall_time;
        convert_measurement = convert_wall_time;
        break;
      #if defined(MEASURE_CPU_TIME)
      case MEASURE_CPU_TIME:
        if (cpu_frequency == 0)
            cpu_frequency = measure_cpu_time();
        get_measurement = measure_cpu_time;
        convert_measurement = convert_cpu_time;
        break;
      #endif
      #if defined(MEASURE_ALLOCATIONS)
      case MEASURE_ALLOCATIONS:
        get_measurement = measure_allocations;
        convert_measurement = convert_allocations;
        break;
      #endif
      #if defined(MEASURE_MEMORY)
      case MEASURE_MEMORY:
        get_measurement = measure_memory;
        convert_measurement = convert_memory;
        break;
      #endif
      #if defined(MEASURE_GC_RUNS)
      case MEASURE_GC_RUNS:
        get_measurement = measure_gc_runs;
        convert_measurement = convert_gc_runs;
        break;
      #endif
      #if defined(MEASURE_GC_TIME)
      case MEASURE_GC_TIME:
        get_measurement = measure_gc_time;
        convert_measurement = convert_gc_time;
        break;
      #endif
      default:
        rb_raise(rb_eArgError, "invalid mode: %d", mode);
        break;
    }
    measure_mode = mode;
    return val;
}
static VALUE prof_set_measure_mode ( VALUE self , VALUE val ) { long mode = NUM2LONG ( val ) ; if ( threads_tbl ) { rb_raise ( rb_eRuntimeError , " " ) ; } switch ( mode ) { case MEASURE_PROCESS_TIME : get_measurement = measure_process_time ; convert_measurement = convert_process_time ; break ; case MEASURE_WALL_TIME : get_measurement = measure_wall_time ; convert_measurement = convert_wall_time ; break ; #if defined ( MEASURE_CPU_TIME ) case MEASURE_CPU_TIME : if ( cpu_frequency == 0 ) cpu_frequency = measure_cpu_time ( ) ; get_measurement = measure_cpu_time ; convert_measurement = convert_cpu_time ; break ; #endif #if defined ( MEASURE_ALLOCATIONS ) case MEASURE_ALLOCATIONS : get_measurement = measure_allocations ; convert_measurement = convert_allocations ; break ; #endif #if defined ( MEASURE_MEMORY ) case MEASURE_MEMORY : get_measurement = measure_memory ; convert_measurement = convert_memory ; break ; #endif #if defined ( MEASURE_GC_RUNS ) case MEASURE_GC_RUNS : get_measurement = measure_gc_runs ; convert_measurement = convert_gc_runs ; break ; #endif #if defined ( MEASURE_GC_TIME ) case MEASURE_GC_TIME : get_measurement = measure_gc_time ; convert_measurement = convert_gc_time ; break ; #endif default : rb_raise ( rb_eArgError , " " , mode ) ; break ; } measure_mode = mode ; return val ; }
call-seq:
measure_mode=value -> void
call - seq : measure_mode = value - > void