ruby-prof 0.4.1-mswin32 → 0.5.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +30 -0
- data/README +65 -25
- data/Rakefile +33 -32
- data/bin/ruby-prof +100 -83
- data/examples/graph.html +65 -69
- data/ext/measure_allocations.h +43 -0
- data/ext/measure_cpu_time.h +138 -0
- data/ext/measure_process_time.h +41 -0
- data/ext/measure_wall_time.h +42 -0
- data/ext/ruby_prof.c +737 -653
- data/lib/ruby-prof.rb +41 -38
- data/lib/ruby-prof/abstract_printer.rb +42 -0
- data/lib/ruby-prof/call_tree_printer.rb +69 -0
- data/lib/ruby-prof/flat_printer.rb +78 -75
- data/lib/ruby-prof/graph_html_printer.rb +241 -228
- data/lib/ruby-prof/graph_printer.rb +160 -141
- data/lib/ruby-prof/profile_test_case.rb +80 -0
- data/lib/ruby-prof/rails_plugin/ruby-prof/init.rb +6 -0
- data/lib/ruby-prof/rails_plugin/ruby-prof/lib/profiling.rb +52 -0
- data/lib/ruby-prof/task.rb +147 -0
- data/lib/ruby_prof.so +0 -0
- data/test/basic_test.rb +65 -35
- data/test/duplicate_names_test.rb +20 -24
- data/test/gc.log +5 -0
- data/test/measure_mode_test.rb +79 -0
- data/test/module_test.rb +31 -18
- data/test/no_method_class_test.rb +14 -0
- data/test/prime1.rb +17 -0
- data/test/prime2.rb +26 -0
- data/test/prime3.rb +17 -0
- data/test/prime_test.rb +10 -10
- data/test/printers_test.rb +14 -12
- data/test/profile_unit_test.rb +24 -0
- data/test/recursive_test.rb +105 -17
- data/test/singleton_test.rb +38 -0
- data/test/start_test.rb +24 -0
- data/test/test_helper.rb +33 -29
- data/test/test_suite.rb +10 -2
- data/test/thread_test.rb +123 -17
- data/test/timing_test.rb +70 -29
- metadata +28 -30
- data/doc/created.rid +0 -1
- data/doc/files/LICENSE.html +0 -0
- data/doc/files/README.html +0 -376
- data/doc/files/bin/ruby-prof.html +0 -143
- data/doc/files/examples/flat_txt.html +0 -179
- data/doc/files/examples/graph_html.html +0 -948
- data/doc/files/examples/graph_txt.html +0 -297
- data/doc/files/ext/ruby_prof_c.html +0 -101
- data/doc/files/lib/ruby-prof/flat_printer_rb.html +0 -101
- data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +0 -108
- data/doc/files/lib/ruby-prof/graph_printer_rb.html +0 -101
- data/doc/files/lib/ruby-prof/profiletask_rb.html +0 -109
- data/doc/files/lib/ruby-prof_rb.html +0 -111
- data/doc/files/lib/unprof_rb.html +0 -108
- data/doc/rdoc-style.css +0 -208
- data/lib/ruby-prof/profiletask.rb +0 -150
- data/test/clock_mode_test.rb +0 -73
data/examples/graph.html
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
2
|
<html>
|
3
|
-
<!-- :nodoc: -->
|
4
3
|
<head>
|
5
4
|
<style media="all" type="text/css">
|
6
5
|
table {
|
@@ -55,7 +54,7 @@
|
|
55
54
|
of control through a program and which methods take the most time.</p>
|
56
55
|
<p>Below is the output from running printers_test.rb reproduced in HTML. </p>
|
57
56
|
<p>Profile Report</p>
|
58
|
-
|
57
|
+
|
59
58
|
<table>
|
60
59
|
<tr>
|
61
60
|
<th>Thread ID</th>
|
@@ -66,7 +65,7 @@ of control through a program and which methods take the most time.</p>
|
|
66
65
|
<td>8.766</td>
|
67
66
|
</tr>
|
68
67
|
</table>
|
69
|
-
|
68
|
+
|
70
69
|
<h2><a name="21277412">Thread 21277412</a></h2>
|
71
70
|
<table>
|
72
71
|
<tr>
|
@@ -78,7 +77,7 @@ of control through a program and which methods take the most time.</p>
|
|
78
77
|
<th> Calls</th>
|
79
78
|
<th>Name</th>
|
80
79
|
</tr>
|
81
|
-
|
80
|
+
|
82
81
|
<tr class="method">
|
83
82
|
<td> 100.00%</td>
|
84
83
|
<td> 0.00%</td>
|
@@ -88,7 +87,7 @@ of control through a program and which methods take the most time.</p>
|
|
88
87
|
<td> 1</td>
|
89
88
|
<td><a name="_toplevel_21277412">#toplevel</a></td>
|
90
89
|
</tr>
|
91
|
-
|
90
|
+
|
92
91
|
<tr>
|
93
92
|
<td> </td>
|
94
93
|
<td> </td>
|
@@ -98,11 +97,11 @@ of control through a program and which methods take the most time.</p>
|
|
98
97
|
<td> 1/1</td>
|
99
98
|
<td><a href="#Object_run_primes_21277412">Object#run_primes</a></td>
|
100
99
|
</tr>
|
101
|
-
|
100
|
+
|
102
101
|
<tr class="break">
|
103
102
|
<td colspan="7"></td>
|
104
103
|
</tr>
|
105
|
-
|
104
|
+
|
106
105
|
<tr>
|
107
106
|
<td> </td>
|
108
107
|
<td> </td>
|
@@ -121,7 +120,7 @@ of control through a program and which methods take the most time.</p>
|
|
121
120
|
<td> 1</td>
|
122
121
|
<td><a name="Object_run_primes_21277412">Object#run_primes</a></td>
|
123
122
|
</tr>
|
124
|
-
|
123
|
+
|
125
124
|
<tr>
|
126
125
|
<td> </td>
|
127
126
|
<td> </td>
|
@@ -149,11 +148,11 @@ of control through a program and which methods take the most time.</p>
|
|
149
148
|
<td> 1/1</td>
|
150
149
|
<td><a href="#Object_find_primes_21277412">Object#find_primes</a></td>
|
151
150
|
</tr>
|
152
|
-
|
151
|
+
|
153
152
|
<tr class="break">
|
154
153
|
<td colspan="7"></td>
|
155
154
|
</tr>
|
156
|
-
|
155
|
+
|
157
156
|
<tr>
|
158
157
|
<td> </td>
|
159
158
|
<td> </td>
|
@@ -181,7 +180,7 @@ of control through a program and which methods take the most time.</p>
|
|
181
180
|
<td> 501</td>
|
182
181
|
<td><a name="Integer_upto_21277412">Integer#upto</a></td>
|
183
182
|
</tr>
|
184
|
-
|
183
|
+
|
185
184
|
<tr>
|
186
185
|
<td> </td>
|
187
186
|
<td> </td>
|
@@ -227,11 +226,11 @@ of control through a program and which methods take the most time.</p>
|
|
227
226
|
<td> 250862/250862</td>
|
228
227
|
<td><a href="#Fixnum_%_21277412">Fixnum#%</a></td>
|
229
228
|
</tr>
|
230
|
-
|
229
|
+
|
231
230
|
<tr class="break">
|
232
231
|
<td colspan="7"></td>
|
233
232
|
</tr>
|
234
|
-
|
233
|
+
|
235
234
|
<tr>
|
236
235
|
<td> </td>
|
237
236
|
<td> </td>
|
@@ -250,7 +249,7 @@ of control through a program and which methods take the most time.</p>
|
|
250
249
|
<td> 1</td>
|
251
250
|
<td><a name="Array_select_21277412">Array#select</a></td>
|
252
251
|
</tr>
|
253
|
-
|
252
|
+
|
254
253
|
<tr>
|
255
254
|
<td> </td>
|
256
255
|
<td> </td>
|
@@ -260,11 +259,11 @@ of control through a program and which methods take the most time.</p>
|
|
260
259
|
<td> 500/500</td>
|
261
260
|
<td><a href="#Object_is_prime_21277412">Object#is_prime</a></td>
|
262
261
|
</tr>
|
263
|
-
|
262
|
+
|
264
263
|
<tr class="break">
|
265
264
|
<td colspan="7"></td>
|
266
265
|
</tr>
|
267
|
-
|
266
|
+
|
268
267
|
<tr>
|
269
268
|
<td> </td>
|
270
269
|
<td> </td>
|
@@ -283,7 +282,6 @@ of control through a program and which methods take the most time.</p>
|
|
283
282
|
<td> 1</td>
|
284
283
|
<td><a name="Object_find_primes_21277412">Object#find_primes</a></td>
|
285
284
|
</tr>
|
286
|
-
<!-- Children -->
|
287
285
|
<tr>
|
288
286
|
<td> </td>
|
289
287
|
<td> </td>
|
@@ -293,11 +291,10 @@ of control through a program and which methods take the most time.</p>
|
|
293
291
|
<td> 1/1</td>
|
294
292
|
<td><a href="#Array_select_21277412">Array#select</a></td>
|
295
293
|
</tr>
|
296
|
-
<!-- Create divider row -->
|
297
294
|
<tr class="break">
|
298
295
|
<td colspan="7"></td>
|
299
296
|
</tr>
|
300
|
-
|
297
|
+
|
301
298
|
<tr>
|
302
299
|
<td> </td>
|
303
300
|
<td> </td>
|
@@ -316,7 +313,7 @@ of control through a program and which methods take the most time.</p>
|
|
316
313
|
<td> 500</td>
|
317
314
|
<td><a name="Object_is_prime_21277412">Object#is_prime</a></td>
|
318
315
|
</tr>
|
319
|
-
|
316
|
+
|
320
317
|
<tr>
|
321
318
|
<td> </td>
|
322
319
|
<td> </td>
|
@@ -335,11 +332,11 @@ of control through a program and which methods take the most time.</p>
|
|
335
332
|
<td> 500/501</td>
|
336
333
|
<td><a href="#Integer_upto_21277412">Integer#upto</a></td>
|
337
334
|
</tr>
|
338
|
-
|
335
|
+
|
339
336
|
<tr class="break">
|
340
337
|
<td colspan="7"></td>
|
341
338
|
</tr>
|
342
|
-
|
339
|
+
|
343
340
|
<tr>
|
344
341
|
<td> </td>
|
345
342
|
<td> </td>
|
@@ -358,7 +355,7 @@ of control through a program and which methods take the most time.</p>
|
|
358
355
|
<td> 1</td>
|
359
356
|
<td><a name="Object_find_largest_21277412">Object#find_largest</a></td>
|
360
357
|
</tr>
|
361
|
-
|
358
|
+
|
362
359
|
<tr>
|
363
360
|
<td> </td>
|
364
361
|
<td> </td>
|
@@ -395,11 +392,11 @@ of control through a program and which methods take the most time.</p>
|
|
395
392
|
<td> 1/1</td>
|
396
393
|
<td><a href="#Array_length_21277412">Array#length</a></td>
|
397
394
|
</tr>
|
398
|
-
|
395
|
+
|
399
396
|
<tr class="break">
|
400
397
|
<td colspan="7"></td>
|
401
398
|
</tr>
|
402
|
-
|
399
|
+
|
403
400
|
<tr>
|
404
401
|
<td> </td>
|
405
402
|
<td> </td>
|
@@ -418,12 +415,12 @@ of control through a program and which methods take the most time.</p>
|
|
418
415
|
<td> 61</td>
|
419
416
|
<td><a name="Kernel_sleep_21277412">Kernel.sleep</a></td>
|
420
417
|
</tr>
|
421
|
-
|
422
|
-
|
418
|
+
|
419
|
+
|
423
420
|
<tr class="break">
|
424
421
|
<td colspan="7"></td>
|
425
422
|
</tr>
|
426
|
-
|
423
|
+
|
427
424
|
<tr>
|
428
425
|
<td> </td>
|
429
426
|
<td> </td>
|
@@ -442,12 +439,11 @@ of control through a program and which methods take the most time.</p>
|
|
442
439
|
<td> 250862</td>
|
443
440
|
<td><a name="Fixnum_%_21277412">Fixnum#%</a></td>
|
444
441
|
</tr>
|
445
|
-
|
446
|
-
<!-- Create divider row -->
|
442
|
+
|
447
443
|
<tr class="break">
|
448
444
|
<td colspan="7"></td>
|
449
445
|
</tr>
|
450
|
-
|
446
|
+
|
451
447
|
<tr>
|
452
448
|
<td> </td>
|
453
449
|
<td> </td>
|
@@ -466,12 +462,12 @@ of control through a program and which methods take the most time.</p>
|
|
466
462
|
<td> 250862</td>
|
467
463
|
<td><a name="Fixnum____21277412">Fixnum#==</a></td>
|
468
464
|
</tr>
|
469
|
-
|
470
|
-
|
465
|
+
|
466
|
+
|
471
467
|
<tr class="break">
|
472
468
|
<td colspan="7"></td>
|
473
469
|
</tr>
|
474
|
-
|
470
|
+
|
475
471
|
<tr>
|
476
472
|
<td> </td>
|
477
473
|
<td> </td>
|
@@ -490,7 +486,7 @@ of control through a program and which methods take the most time.</p>
|
|
490
486
|
<td> 1</td>
|
491
487
|
<td><a name="Object_make_random_array_21277412">Object#make_random_array</a></td>
|
492
488
|
</tr>
|
493
|
-
|
489
|
+
|
494
490
|
<tr>
|
495
491
|
<td> </td>
|
496
492
|
<td> </td>
|
@@ -509,11 +505,11 @@ of control through a program and which methods take the most time.</p>
|
|
509
505
|
<td> 1/1</td>
|
510
506
|
<td><a href="#Class_new_21277412">Class#new</a></td>
|
511
507
|
</tr>
|
512
|
-
|
508
|
+
|
513
509
|
<tr class="break">
|
514
510
|
<td colspan="7"></td>
|
515
511
|
</tr>
|
516
|
-
|
512
|
+
|
517
513
|
<tr>
|
518
514
|
<td> </td>
|
519
515
|
<td> </td>
|
@@ -532,7 +528,7 @@ of control through a program and which methods take the most time.</p>
|
|
532
528
|
<td> 1</td>
|
533
529
|
<td><a name="Array_each_index_21277412">Array#each_index</a></td>
|
534
530
|
</tr>
|
535
|
-
|
531
|
+
|
536
532
|
<tr>
|
537
533
|
<td> </td>
|
538
534
|
<td> </td>
|
@@ -551,11 +547,11 @@ of control through a program and which methods take the most time.</p>
|
|
551
547
|
<td> 500/500</td>
|
552
548
|
<td><a href="#Array_[]__21277412">Array#[]=</a></td>
|
553
549
|
</tr>
|
554
|
-
|
550
|
+
|
555
551
|
<tr class="break">
|
556
552
|
<td colspan="7"></td>
|
557
553
|
</tr>
|
558
|
-
|
554
|
+
|
559
555
|
<tr>
|
560
556
|
<td> </td>
|
561
557
|
<td> </td>
|
@@ -583,12 +579,12 @@ of control through a program and which methods take the most time.</p>
|
|
583
579
|
<td> 501</td>
|
584
580
|
<td><a name="Fixnum_-_21277412">Fixnum#-</a></td>
|
585
581
|
</tr>
|
586
|
-
|
587
|
-
|
582
|
+
|
583
|
+
|
588
584
|
<tr class="break">
|
589
585
|
<td colspan="7"></td>
|
590
586
|
</tr>
|
591
|
-
|
587
|
+
|
592
588
|
<tr>
|
593
589
|
<td> </td>
|
594
590
|
<td> </td>
|
@@ -607,12 +603,12 @@ of control through a program and which methods take the most time.</p>
|
|
607
603
|
<td> 1</td>
|
608
604
|
<td><a name="Integer_to_int_21277412">Integer#to_int</a></td>
|
609
605
|
</tr>
|
610
|
-
|
611
|
-
|
606
|
+
|
607
|
+
|
612
608
|
<tr class="break">
|
613
609
|
<td colspan="7"></td>
|
614
610
|
</tr>
|
615
|
-
|
611
|
+
|
616
612
|
<tr>
|
617
613
|
<td> </td>
|
618
614
|
<td> </td>
|
@@ -631,12 +627,12 @@ of control through a program and which methods take the most time.</p>
|
|
631
627
|
<td> 1</td>
|
632
628
|
<td><a name="Array_first_21277412">Array#first</a></td>
|
633
629
|
</tr>
|
634
|
-
|
635
|
-
|
630
|
+
|
631
|
+
|
636
632
|
<tr class="break">
|
637
633
|
<td colspan="7"></td>
|
638
634
|
</tr>
|
639
|
-
|
635
|
+
|
640
636
|
<tr>
|
641
637
|
<td> </td>
|
642
638
|
<td> </td>
|
@@ -655,12 +651,12 @@ of control through a program and which methods take the most time.</p>
|
|
655
651
|
<td> 1</td>
|
656
652
|
<td><a name="Array_initialize_21277412">Array#initialize</a></td>
|
657
653
|
</tr>
|
658
|
-
|
659
|
-
|
654
|
+
|
655
|
+
|
660
656
|
<tr class="break">
|
661
657
|
<td colspan="7"></td>
|
662
658
|
</tr>
|
663
|
-
|
659
|
+
|
664
660
|
<tr>
|
665
661
|
<td> </td>
|
666
662
|
<td> </td>
|
@@ -679,12 +675,12 @@ of control through a program and which methods take the most time.</p>
|
|
679
675
|
<td> 1</td>
|
680
676
|
<td><a name="Array_length_21277412">Array#length</a></td>
|
681
677
|
</tr>
|
682
|
-
|
683
|
-
|
678
|
+
|
679
|
+
|
684
680
|
<tr class="break">
|
685
681
|
<td colspan="7"></td>
|
686
682
|
</tr>
|
687
|
-
|
683
|
+
|
688
684
|
<tr>
|
689
685
|
<td> </td>
|
690
686
|
<td> </td>
|
@@ -703,7 +699,7 @@ of control through a program and which methods take the most time.</p>
|
|
703
699
|
<td> 1</td>
|
704
700
|
<td><a name="Class_new_21277412">Class#new</a></td>
|
705
701
|
</tr>
|
706
|
-
|
702
|
+
|
707
703
|
<tr>
|
708
704
|
<td> </td>
|
709
705
|
<td> </td>
|
@@ -713,11 +709,11 @@ of control through a program and which methods take the most time.</p>
|
|
713
709
|
<td> 1/1</td>
|
714
710
|
<td><a href="#Array_initialize_21277412">Array#initialize</a></td>
|
715
711
|
</tr>
|
716
|
-
|
712
|
+
|
717
713
|
<tr class="break">
|
718
714
|
<td colspan="7"></td>
|
719
715
|
</tr>
|
720
|
-
|
716
|
+
|
721
717
|
<tr>
|
722
718
|
<td> </td>
|
723
719
|
<td> </td>
|
@@ -736,12 +732,12 @@ of control through a program and which methods take the most time.</p>
|
|
736
732
|
<td> 61</td>
|
737
733
|
<td><a name="Fixnum_>_21277412">Fixnum#_</a></td>
|
738
734
|
</tr>
|
739
|
-
|
740
|
-
|
735
|
+
|
736
|
+
|
741
737
|
<tr class="break">
|
742
738
|
<td colspan="7"></td>
|
743
739
|
</tr>
|
744
|
-
|
740
|
+
|
745
741
|
<tr>
|
746
742
|
<td> </td>
|
747
743
|
<td> </td>
|
@@ -760,12 +756,12 @@ of control through a program and which methods take the most time.</p>
|
|
760
756
|
<td> 61</td>
|
761
757
|
<td><a name="Array_[]_21277412">Array#[]</a></td>
|
762
758
|
</tr>
|
763
|
-
|
764
|
-
|
759
|
+
|
760
|
+
|
765
761
|
<tr class="break">
|
766
762
|
<td colspan="7"></td>
|
767
763
|
</tr>
|
768
|
-
|
764
|
+
|
769
765
|
<tr>
|
770
766
|
<td> </td>
|
771
767
|
<td> </td>
|
@@ -784,12 +780,12 @@ of control through a program and which methods take the most time.</p>
|
|
784
780
|
<td> 500</td>
|
785
781
|
<td><a name="Array_[]__21277412">Array#[]=</a></td>
|
786
782
|
</tr>
|
787
|
-
|
788
|
-
|
783
|
+
|
784
|
+
|
789
785
|
<tr class="break">
|
790
786
|
<td colspan="7"></td>
|
791
787
|
</tr>
|
792
|
-
|
788
|
+
|
793
789
|
<tr>
|
794
790
|
<td> </td>
|
795
791
|
<td> </td>
|
@@ -808,7 +804,7 @@ of control through a program and which methods take the most time.</p>
|
|
808
804
|
<td> 500</td>
|
809
805
|
<td><a name="Kernel_rand_21277412">Kernel.rand</a></td>
|
810
806
|
</tr>
|
811
|
-
|
807
|
+
|
812
808
|
<tr>
|
813
809
|
<td> </td>
|
814
810
|
<td> </td>
|
@@ -818,7 +814,7 @@ of control through a program and which methods take the most time.</p>
|
|
818
814
|
<td> 1/1</td>
|
819
815
|
<td><a href="#Integer_to_int_21277412">Integer#to_int</a></td>
|
820
816
|
</tr>
|
821
|
-
|
817
|
+
|
822
818
|
<tr class="break">
|
823
819
|
<td colspan="7"></td>
|
824
820
|
</tr>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* :nodoc:
|
2
|
+
* Copyright (C) 2007 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
|
+
#if defined(HAVE_RB_OS_ALLOCATED_OBJECTS)
|
29
|
+
#define MEASURE_ALLOCATIONS 3
|
30
|
+
|
31
|
+
static prof_measure_t
|
32
|
+
measure_allocations()
|
33
|
+
{
|
34
|
+
return rb_os_allocated_objects();
|
35
|
+
}
|
36
|
+
|
37
|
+
static double
|
38
|
+
convert_allocations(prof_measure_t c)
|
39
|
+
{
|
40
|
+
return c;
|
41
|
+
}
|
42
|
+
|
43
|
+
#endif
|