ruby-prof 0.10.8 → 0.11.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/CHANGES +38 -18
  2. data/LICENSE +4 -3
  3. data/README.rdoc +30 -66
  4. data/Rakefile +47 -54
  5. data/bin/ruby-prof +24 -4
  6. data/ext/ruby_prof/extconf.rb +9 -16
  7. data/ext/ruby_prof/rp_call_info.c +369 -0
  8. data/ext/ruby_prof/rp_call_info.h +46 -0
  9. data/ext/ruby_prof/rp_measure.c +48 -0
  10. data/ext/ruby_prof/rp_measure.h +45 -0
  11. data/ext/ruby_prof/rp_measure_allocations.c +86 -0
  12. data/ext/ruby_prof/rp_measure_cpu_time.c +112 -0
  13. data/ext/ruby_prof/rp_measure_gc_runs.c +87 -0
  14. data/ext/ruby_prof/rp_measure_gc_time.c +73 -0
  15. data/ext/ruby_prof/rp_measure_memory.c +81 -0
  16. data/ext/ruby_prof/rp_measure_process_time.c +71 -0
  17. data/ext/ruby_prof/rp_measure_wall_time.c +42 -0
  18. data/ext/ruby_prof/rp_method.c +363 -0
  19. data/ext/ruby_prof/rp_method.h +55 -0
  20. data/ext/ruby_prof/rp_stack.c +61 -0
  21. data/ext/ruby_prof/rp_stack.h +40 -0
  22. data/ext/ruby_prof/rp_thread.c +113 -0
  23. data/ext/ruby_prof/rp_thread.h +20 -0
  24. data/ext/ruby_prof/ruby_prof.c +259 -1398
  25. data/ext/ruby_prof/ruby_prof.h +54 -190
  26. data/ext/ruby_prof/version.h +6 -3
  27. data/lib/1.8/ruby_prof.so +0 -0
  28. data/lib/1.9/ruby_prof.exp +0 -0
  29. data/lib/1.9/ruby_prof.ilk +0 -0
  30. data/lib/1.9/ruby_prof.lib +0 -0
  31. data/lib/1.9/ruby_prof.pdb +0 -0
  32. data/lib/1.9/ruby_prof.so +0 -0
  33. data/lib/ruby-prof.rb +14 -11
  34. data/lib/ruby-prof/abstract_printer.rb +10 -0
  35. data/lib/ruby-prof/aggregate_call_info.rb +2 -0
  36. data/lib/ruby-prof/call_info.rb +2 -0
  37. data/lib/ruby-prof/call_stack_printer.rb +2 -4
  38. data/lib/ruby-prof/call_tree_printer.rb +1 -0
  39. data/lib/ruby-prof/compatibility.rb +134 -0
  40. data/lib/ruby-prof/dot_printer.rb +7 -7
  41. data/lib/ruby-prof/flat_printer.rb +7 -7
  42. data/lib/ruby-prof/flat_printer_with_line_numbers.rb +2 -5
  43. data/lib/ruby-prof/graph_html_printer.rb +4 -2
  44. data/lib/ruby-prof/graph_printer.rb +4 -3
  45. data/lib/ruby-prof/method_info.rb +2 -0
  46. data/lib/ruby-prof/multi_printer.rb +2 -0
  47. data/lib/ruby-prof/{result.rb → profile.rb} +3 -1
  48. data/lib/ruby-prof/rack.rb +1 -0
  49. data/lib/ruby-prof/symbol_to_proc.rb +2 -0
  50. data/lib/ruby-prof/task.rb +1 -0
  51. data/lib/ruby-prof/test.rb +2 -0
  52. data/lib/ruby_prof.exp +0 -0
  53. data/lib/ruby_prof.ilk +0 -0
  54. data/lib/ruby_prof.lib +0 -0
  55. data/lib/ruby_prof.pdb +0 -0
  56. data/lib/ruby_prof.so +0 -0
  57. data/lib/unprof.rb +2 -0
  58. data/test/aggregate_test.rb +8 -8
  59. data/test/basic_test.rb +3 -251
  60. data/test/bug_test.rb +6 -0
  61. data/test/duplicate_names_test.rb +2 -2
  62. data/test/dynamic_method_test.rb +61 -0
  63. data/test/enumerable_test.rb +2 -2
  64. data/test/exceptions_test.rb +4 -3
  65. data/test/exclude_threads_test.rb +2 -2
  66. data/test/exec_test.rb +3 -3
  67. data/test/line_number_test.rb +5 -5
  68. data/test/measure_allocations_test.rb +25 -0
  69. data/test/measure_cpu_time_test.rb +212 -0
  70. data/test/measure_gc_runs_test.rb +29 -0
  71. data/test/measure_gc_time_test.rb +29 -0
  72. data/test/measure_memory_test.rb +36 -0
  73. data/test/measure_process_time_test.rb +205 -0
  74. data/test/measure_wall_time_test.rb +209 -0
  75. data/test/method_elimination_test.rb +2 -2
  76. data/test/module_test.rb +3 -2
  77. data/test/multi_printer_test.rb +2 -2
  78. data/test/no_method_class_test.rb +3 -1
  79. data/test/prime_test.rb +3 -3
  80. data/test/printers_test.rb +106 -8
  81. data/test/recursive_test.rb +7 -6
  82. data/test/singleton_test.rb +2 -2
  83. data/test/stack_printer_test.rb +2 -3
  84. data/test/stack_test.rb +2 -2
  85. data/test/start_stop_test.rb +2 -2
  86. data/test/test_helper.rb +81 -0
  87. data/test/test_suite.rb +34 -29
  88. data/test/thread_test.rb +24 -23
  89. data/test/unique_call_path_test.rb +2 -2
  90. metadata +101 -69
  91. data/ext/ruby_prof/measure_allocations.h +0 -83
  92. data/ext/ruby_prof/measure_cpu_time.h +0 -152
  93. data/ext/ruby_prof/measure_gc_runs.h +0 -76
  94. data/ext/ruby_prof/measure_gc_time.h +0 -57
  95. data/ext/ruby_prof/measure_memory.h +0 -101
  96. data/ext/ruby_prof/measure_process_time.h +0 -63
  97. data/ext/ruby_prof/measure_wall_time.h +0 -53
  98. data/ext/ruby_prof/mingw/Rakefile +0 -23
  99. data/ext/ruby_prof/mingw/build.rake +0 -38
  100. data/rails/environment/profile.rb +0 -24
  101. data/rails/example/example_test.rb +0 -9
  102. data/rails/profile_test_helper.rb +0 -21
  103. data/test/current_failures_windows +0 -8
  104. data/test/measurement_test.rb +0 -132
  105. data/test/ruby-prof-bin +0 -20
@@ -1,76 +0,0 @@
1
- /* :nodoc:
2
- * Copyright (C) 2008 Shugo Maeda <shugo@ruby-lang.org>
3
- * Charlie Savage <cfis@savagexi.com>
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
- * SUCH DAMAGE. */
26
-
27
- #if defined(HAVE_RB_GC_COLLECTIONS)
28
- #define MEASURE_GC_RUNS 5
29
-
30
- static prof_measure_t
31
- measure_gc_runs()
32
- {
33
- return NUM2INT(rb_gc_collections());
34
- }
35
-
36
- static double
37
- convert_gc_runs(prof_measure_t c)
38
- {
39
- return c;
40
- }
41
-
42
- /* Document-method: prof_measure_gc_runs
43
- call-seq:
44
- gc_runs -> Integer
45
-
46
- Returns the total number of garbage collections.*/
47
- static VALUE
48
- prof_measure_gc_runs(VALUE self)
49
- {
50
- return rb_gc_collections();
51
- }
52
-
53
- #elif defined(HAVE_RB_GC_HEAP_INFO)
54
- #define MEASURE_GC_RUNS 5
55
-
56
- static prof_measure_t
57
- measure_gc_runs()
58
- {
59
- VALUE h = rb_gc_heap_info();
60
- return NUM2UINT(rb_hash_aref(h, rb_str_new2("num_gc_passes")));
61
- }
62
-
63
- static double
64
- convert_gc_runs(prof_measure_t c)
65
- {
66
- return c;
67
- }
68
-
69
- static VALUE
70
- prof_measure_gc_runs(VALUE self)
71
- {
72
- VALUE h = rb_gc_heap_info();
73
- return rb_hash_aref(h, rb_str_new2("num_gc_passes"));
74
- }
75
-
76
- #endif
@@ -1,57 +0,0 @@
1
- /* :nodoc:
2
- * Copyright (C) 2008 Shugo Maeda <shugo@ruby-lang.org>
3
- * Charlie Savage <cfis@savagexi.com>
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
- * SUCH DAMAGE. */
26
-
27
- #if defined(HAVE_RB_GC_TIME)
28
- #define MEASURE_GC_TIME 6
29
-
30
- static prof_measure_t
31
- measure_gc_time()
32
- {
33
- #if HAVE_LONG_LONG
34
- return NUM2LL(rb_gc_time());
35
- #else
36
- return NUM2LONG(rb_gc_time());
37
- #endif
38
- }
39
-
40
- static double
41
- convert_gc_time(prof_measure_t c)
42
- {
43
- return (double) c / 1000000;
44
- }
45
-
46
- /* Document-method: prof_measure_gc_time
47
- call-seq:
48
- gc_time -> Integer
49
-
50
- Returns the time spent doing garbage collections in microseconds.*/
51
- static VALUE
52
- prof_measure_gc_time(VALUE self)
53
- {
54
- return rb_gc_time();
55
- }
56
-
57
- #endif
@@ -1,101 +0,0 @@
1
- /* :nodoc:
2
- * Copyright (C) 2008 Alexander Dymo <adymo@pluron.com>
3
- *
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
- * SUCH DAMAGE. */
26
-
27
-
28
- #if defined(HAVE_RB_GC_ALLOCATED_SIZE)
29
- #define MEASURE_MEMORY 4
30
- #define TOGGLE_GC_STATS 1
31
-
32
- static prof_measure_t
33
- measure_memory()
34
- {
35
- #if defined(HAVE_LONG_LONG)
36
- return NUM2LL(rb_gc_allocated_size());
37
- #else
38
- return NUM2ULONG(rb_gc_allocated_size());
39
- #endif
40
- }
41
-
42
- static double
43
- convert_memory(prof_measure_t c)
44
- {
45
- return (double) c / 1024;
46
- }
47
-
48
- /* Document-method: prof_measure_memory
49
- call-seq:
50
- measure_memory -> int
51
-
52
- Returns total allocated memory in bytes.*/
53
- static VALUE
54
- prof_measure_memory(VALUE self)
55
- {
56
- return rb_gc_allocated_size();
57
- }
58
-
59
- #elif defined(HAVE_RB_GC_MALLOC_ALLOCATED_SIZE)
60
- #define MEASURE_MEMORY 4
61
-
62
- static prof_measure_t
63
- measure_memory()
64
- {
65
- return rb_gc_malloc_allocated_size();
66
- }
67
-
68
- static double
69
- convert_memory(prof_measure_t c)
70
- {
71
- return (double) c / 1024;
72
- }
73
-
74
- static VALUE
75
- prof_measure_memory(VALUE self)
76
- {
77
- return UINT2NUM(rb_gc_malloc_allocated_size());
78
- }
79
-
80
- #elif defined(HAVE_RB_HEAP_TOTAL_MEM)
81
- #define MEASURE_MEMORY 4
82
-
83
- static prof_measure_t
84
- measure_memory()
85
- {
86
- return rb_heap_total_mem();
87
- }
88
-
89
- static double
90
- convert_memory(prof_measure_t c)
91
- {
92
- return (double) c / 1024;
93
- }
94
-
95
- static VALUE
96
- prof_measure_memory(VALUE self)
97
- {
98
- return ULONG2NUM(rb_heap_total_mem());
99
- }
100
-
101
- #endif
@@ -1,63 +0,0 @@
1
- /*
2
- * Copyright (C) 2008 Shugo Maeda <shugo@ruby-lang.org>
3
- * Charlie Savage <cfis@savagexi.com>
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
- * SUCH DAMAGE. */
26
-
27
- #include <time.h>
28
-
29
- #define MEASURE_PROCESS_TIME 0
30
-
31
- static prof_measure_t
32
- measure_process_time()
33
- {
34
- #if defined(__linux__)
35
- struct timespec time;
36
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID , &time);
37
- return time.tv_sec * 1000000000 + time.tv_nsec ;
38
- #else
39
- return clock();
40
- #endif
41
- }
42
-
43
-
44
- static double
45
- convert_process_time(prof_measure_t c)
46
- {
47
- #if defined(__linux__)
48
- return (double) c / 1000000000;
49
- #else
50
- return (double) c / CLOCKS_PER_SEC;
51
- #endif
52
- }
53
-
54
- /* Document-method: measure_process_time
55
- call-seq:
56
- measure_process_time -> float
57
-
58
- Returns the process time.*/
59
- static VALUE
60
- prof_measure_process_time(VALUE self)
61
- {
62
- return rb_float_new(convert_process_time(measure_process_time()));
63
- }
@@ -1,53 +0,0 @@
1
- /* :nodoc:
2
- * Copyright (C) 2008 Shugo Maeda <shugo@ruby-lang.org>
3
- * Charlie Savage <cfis@savagexi.com>
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
- * SUCH DAMAGE. */
26
-
27
-
28
- #define MEASURE_WALL_TIME 1
29
-
30
- static prof_measure_t
31
- measure_wall_time()
32
- {
33
- struct timeval tv;
34
- gettimeofday(&tv, NULL);
35
- return tv.tv_sec * 1000000 + tv.tv_usec;
36
- }
37
-
38
- static double
39
- convert_wall_time(prof_measure_t c)
40
- {
41
- return (double) c / 1000000;
42
- }
43
-
44
- /* Document-method: prof_measure_wall_time
45
- call-seq:
46
- measure_wall_time -> float
47
-
48
- Returns the wall time.*/
49
- static VALUE
50
- prof_measure_wall_time(VALUE self)
51
- {
52
- return rb_float_new(convert_wall_time(measure_wall_time()));
53
- }
@@ -1,23 +0,0 @@
1
- # We can't use Ruby's standard build procedures
2
- # on Windows because the Ruby executable is
3
- # built with VC++ while here we want to build
4
- # with MingW. So just roll our own...
5
-
6
- require 'fileutils'
7
- require 'rbconfig'
8
-
9
- EXTENSION_NAME = "ruby_prof.#{Config::CONFIG["DLEXT"]}"
10
-
11
- # This is called when the Windows GEM is installed!
12
- task :install do
13
- # Gems will pass these two environment variables:
14
- # RUBYARCHDIR=#{dest_path}
15
- # RUBYLIBDIR=#{dest_path}
16
-
17
- dest_path = ENV['RUBYLIBDIR']
18
-
19
- # Copy the extension
20
- cp(EXTENSION_NAME, dest_path)
21
- end
22
-
23
- task :default => :install
@@ -1,38 +0,0 @@
1
- # We can't use Ruby's standard build procedures
2
- # on Windows because the Ruby executable is
3
- # built with VC++ while here we want to build
4
- # with MingW. So just roll our own...
5
-
6
- require 'rake/clean'
7
- require 'rbconfig'
8
-
9
- RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
10
- RUBY_BIN_DIR = Config::CONFIG["bindir"]
11
- RUBY_LIB_DIR = Config::CONFIG["libdir"]
12
- RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
13
- RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')
14
-
15
- EXTENSION_NAME = "ruby_prof.#{Config::CONFIG["DLEXT"]}"
16
-
17
- CLEAN.include('*.o')
18
- CLOBBER.include(EXTENSION_NAME)
19
-
20
- task :default => "ruby_prof"
21
-
22
- SRC = FileList['../*.c']
23
- OBJ = SRC.collect do |file_name|
24
- File.basename(file_name).ext('o')
25
- end
26
-
27
- SRC.each do |srcfile|
28
- objfile = File.basename(srcfile).ext('o')
29
- file objfile => srcfile do
30
- command = "gcc -c -fPIC -O2 -Wall -o #{objfile} -I/usr/local/include #{srcfile} -I#{RUBY_INCLUDE_DIR}"
31
- sh "sh -c '#{command}'"
32
- end
33
- end
34
-
35
- file "ruby_prof" => OBJ do
36
- command = "gcc -shared -o #{EXTENSION_NAME} -L/usr/local/lib #{OBJ} #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
37
- sh "sh -c '#{command}'"
38
- end
@@ -1,24 +0,0 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
2
- # The profile environment should match the same settings
3
- # as the production environment to give a reasonalbe
4
- # approximation of performance. However, it should
5
- # definitely not use the production databse!
6
-
7
-
8
- # Cache classes - otherwise your code
9
- # will run approximately 5 times slower and the
10
- # profiling results will be overwhelmed by Rails
11
- # dependency loading mechanism
12
- config.cache_classes = true
13
-
14
- # Don't check template timestamps - once again this
15
- # is to avoid IO times overwhelming profile results
16
- config.action_view.cache_template_loading = true
17
-
18
- # This is debatable, but turn off action controller
19
- # caching to see how long it really takes to run
20
- # queries and render templates
21
- config.action_controller.perform_caching = false
22
-
23
- # Turn off most logging
24
- config.log_level = :info
@@ -1,9 +0,0 @@
1
- require File.dirname(__FILE__) + '../profile_test_helper'
2
-
3
- class ExampleTest < Test::Unit::TestCase
4
- include RubyProf::Test
5
-
6
- def test_stuff
7
- puts "Test method"
8
- end
9
- end