rubyrun 0.9.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/LICENSE +13 -0
  2. data/README +77 -0
  3. data/Rakefile +241 -0
  4. data/bin/confgure +2 -0
  5. data/docs/rubyrun-0.9.0.htm +6344 -0
  6. data/docs/rubyrun-0.9.0.pdf +0 -0
  7. data/docs/rubyrun-0.9.0_files/colorschememapping.xml +2 -0
  8. data/docs/rubyrun-0.9.0_files/filelist.xml +29 -0
  9. data/docs/rubyrun-0.9.0_files/header.htm +141 -0
  10. data/docs/rubyrun-0.9.0_files/image001.jpg +0 -0
  11. data/docs/rubyrun-0.9.0_files/image002.jpg +0 -0
  12. data/docs/rubyrun-0.9.0_files/image003.jpg +0 -0
  13. data/docs/rubyrun-0.9.0_files/image004.jpg +0 -0
  14. data/docs/rubyrun-0.9.0_files/image005.jpg +0 -0
  15. data/docs/rubyrun-0.9.0_files/image006.jpg +0 -0
  16. data/docs/rubyrun-0.9.0_files/image007.jpg +0 -0
  17. data/docs/rubyrun-0.9.0_files/image008.jpg +0 -0
  18. data/docs/rubyrun-0.9.0_files/image009.jpg +0 -0
  19. data/docs/rubyrun-0.9.0_files/image010.jpg +0 -0
  20. data/docs/rubyrun-0.9.0_files/image011.jpg +0 -0
  21. data/docs/rubyrun-0.9.0_files/image012.jpg +0 -0
  22. data/docs/rubyrun-0.9.0_files/image013.jpg +0 -0
  23. data/docs/rubyrun-0.9.0_files/image014.jpg +0 -0
  24. data/docs/rubyrun-0.9.0_files/image015.jpg +0 -0
  25. data/docs/rubyrun-0.9.0_files/image016.jpg +0 -0
  26. data/docs/rubyrun-0.9.0_files/image017.png +0 -0
  27. data/docs/rubyrun-0.9.0_files/image018.jpg +0 -0
  28. data/docs/rubyrun-0.9.0_files/image019.jpg +0 -0
  29. data/docs/rubyrun-0.9.0_files/image020.jpg +0 -0
  30. data/docs/rubyrun-0.9.0_files/image021.jpg +0 -0
  31. data/docs/rubyrun-0.9.0_files/image022.png +0 -0
  32. data/docs/rubyrun-0.9.0_files/themedata.thmx +0 -0
  33. data/etc/rubyrun_opts.yml +132 -0
  34. data/ext/extconf.rb +4 -0
  35. data/ext/rubyrunnative__.bundle +0 -0
  36. data/ext/rubyrunnative__.c +154 -0
  37. data/ext/rubyrunnative__.def +2 -0
  38. data/ext/rubyrunnative__.h +36 -0
  39. data/ext/rubyrunnative__.so +0 -0
  40. data/ext/rubyrunnative__linux.so +0 -0
  41. data/html/classes/Module.html +174 -0
  42. data/html/classes/Object.html +151 -0
  43. data/html/classes/RubyRunBufferMgr__.html +182 -0
  44. data/html/classes/RubyRunCommander__.html +578 -0
  45. data/html/classes/RubyRunDad__.html +144 -0
  46. data/html/classes/RubyRunGlobals.html +248 -0
  47. data/html/classes/RubyRunHTMLWriter/RubyRunHTMLDevice.html +157 -0
  48. data/html/classes/RubyRunHTMLWriter.html +186 -0
  49. data/html/classes/RubyRunHTML__.html +198 -0
  50. data/html/classes/RubyRunInitializer__.html +821 -0
  51. data/html/classes/RubyRunInstrumentor__.html +576 -0
  52. data/html/classes/RubyRunMonitor__.html +298 -0
  53. data/html/classes/RubyRunRSS.html +302 -0
  54. data/html/classes/RubyRunReport__.html +294 -0
  55. data/html/classes/RubyRunTracer__.html +253 -0
  56. data/html/classes/RubyRunUtils__.html +376 -0
  57. data/html/created.rid +1 -0
  58. data/html/files/LICENSE.html +119 -0
  59. data/html/files/README.html +197 -0
  60. data/html/files/lib/rubyrun/rubyrun_buffer_mgr___rb.html +101 -0
  61. data/html/files/lib/rubyrun/rubyrun_commander___rb.html +101 -0
  62. data/html/files/lib/rubyrun/rubyrun_dad___rb.html +101 -0
  63. data/html/files/lib/rubyrun/rubyrun_globals_rb.html +101 -0
  64. data/html/files/lib/rubyrun/rubyrun_html___rb.html +101 -0
  65. data/html/files/lib/rubyrun/rubyrun_html_writer___rb.html +108 -0
  66. data/html/files/lib/rubyrun/rubyrun_initializer___rb.html +112 -0
  67. data/html/files/lib/rubyrun/rubyrun_instrumentor___rb.html +116 -0
  68. data/html/files/lib/rubyrun/rubyrun_monitor___rb.html +116 -0
  69. data/html/files/lib/rubyrun/rubyrun_rb.html +121 -0
  70. data/html/files/lib/rubyrun/rubyrun_report___rb.html +101 -0
  71. data/html/files/lib/rubyrun/rubyrun_rss___rb.html +108 -0
  72. data/html/files/lib/rubyrun/rubyrun_tracer___rb.html +110 -0
  73. data/html/files/lib/rubyrun/rubyrun_utils___rb.html +108 -0
  74. data/html/files/lib/rubyrunm_rb.html +116 -0
  75. data/html/fr_class_index.html +42 -0
  76. data/html/fr_file_index.html +43 -0
  77. data/html/fr_method_index.html +96 -0
  78. data/html/index.html +24 -0
  79. data/html/rdoc-style.css +208 -0
  80. data/lib/rubyrun/rubyrun.rb +78 -0
  81. data/lib/rubyrun/rubyrun_buffer_mgr__.rb +49 -0
  82. data/lib/rubyrun/rubyrun_commander__.rb +196 -0
  83. data/lib/rubyrun/rubyrun_dad__.rb +35 -0
  84. data/lib/rubyrun/rubyrun_globals.rb +51 -0
  85. data/lib/rubyrun/rubyrun_html__.rb +136 -0
  86. data/lib/rubyrun/rubyrun_html_writer__.rb +64 -0
  87. data/lib/rubyrun/rubyrun_initializer__.rb +286 -0
  88. data/lib/rubyrun/rubyrun_instrumentor__.rb +226 -0
  89. data/lib/rubyrun/rubyrun_monitor__.rb +237 -0
  90. data/lib/rubyrun/rubyrun_report__.rb +109 -0
  91. data/lib/rubyrun/rubyrun_rss__.rb +97 -0
  92. data/lib/rubyrun/rubyrun_tracer__.rb +79 -0
  93. data/lib/rubyrun/rubyrun_utils__.rb +98 -0
  94. data/lib/rubyrun/rubyrunnative__.so +0 -0
  95. data/lib/rubyrunm.rb +10 -0
  96. metadata +149 -0
Binary file
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <a:clrMap xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
@@ -0,0 +1,29 @@
1
+ <xml xmlns:o="urn:schemas-microsoft-com:office:office">
2
+ <o:MainFile HRef="../rubyrun-0.9.0.htm"/>
3
+ <o:File HRef="themedata.thmx"/>
4
+ <o:File HRef="colorschememapping.xml"/>
5
+ <o:File HRef="image001.jpg"/>
6
+ <o:File HRef="image002.jpg"/>
7
+ <o:File HRef="image003.jpg"/>
8
+ <o:File HRef="image004.jpg"/>
9
+ <o:File HRef="image005.jpg"/>
10
+ <o:File HRef="image006.jpg"/>
11
+ <o:File HRef="image007.jpg"/>
12
+ <o:File HRef="image008.jpg"/>
13
+ <o:File HRef="image009.jpg"/>
14
+ <o:File HRef="image010.jpg"/>
15
+ <o:File HRef="image011.jpg"/>
16
+ <o:File HRef="image012.jpg"/>
17
+ <o:File HRef="image013.jpg"/>
18
+ <o:File HRef="image014.jpg"/>
19
+ <o:File HRef="image015.jpg"/>
20
+ <o:File HRef="image016.jpg"/>
21
+ <o:File HRef="image017.png"/>
22
+ <o:File HRef="image018.jpg"/>
23
+ <o:File HRef="image019.jpg"/>
24
+ <o:File HRef="image020.jpg"/>
25
+ <o:File HRef="image021.jpg"/>
26
+ <o:File HRef="header.htm"/>
27
+ <o:File HRef="image022.png"/>
28
+ <o:File HRef="filelist.xml"/>
29
+ </xml>
@@ -0,0 +1,141 @@
1
+ <html xmlns:v="urn:schemas-microsoft-com:vml"
2
+ xmlns:o="urn:schemas-microsoft-com:office:office"
3
+ xmlns:w="urn:schemas-microsoft-com:office:word"
4
+ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
5
+ xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
6
+ xmlns="http://www.w3.org/TR/REC-html40">
7
+
8
+ <head>
9
+ <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
10
+ <meta name=ProgId content=Word.Document>
11
+ <meta name=Generator content="Microsoft Word 12">
12
+ <meta name=Originator content="Microsoft Word 12">
13
+ <link id=Main-File rel=Main-File href="../rubyrun-0.9.0.htm">
14
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
15
+ name="place"/>
16
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
17
+ name="PlaceName"/>
18
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
19
+ name="PlaceType"/>
20
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
21
+ name="time"/>
22
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
23
+ name="date"/>
24
+ <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
25
+ name="stockticker"/>
26
+ </head>
27
+
28
+ <body lang=EN-US link=blue vlink=purple>
29
+
30
+ <div style='mso-element:footnote-separator' id=fs>
31
+
32
+ <p class=MsoNormal><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
33
+
34
+ <hr align=left size=1 width="33%">
35
+
36
+ <![endif]></span></p>
37
+
38
+ </div>
39
+
40
+ <div style='mso-element:footnote-continuation-separator' id=fcs>
41
+
42
+ <p class=MsoNormal><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
43
+
44
+ <hr align=left size=1>
45
+
46
+ <![endif]></span></p>
47
+
48
+ </div>
49
+
50
+ <div style='mso-element:endnote-separator' id=es>
51
+
52
+ <p class=MsoNormal><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
53
+
54
+ <hr align=left size=1 width="33%">
55
+
56
+ <![endif]></span></p>
57
+
58
+ </div>
59
+
60
+ <div style='mso-element:endnote-continuation-separator' id=ecs>
61
+
62
+ <p class=MsoNormal><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
63
+
64
+ <hr align=left size=1>
65
+
66
+ <![endif]></span></p>
67
+
68
+ </div>
69
+
70
+ <div style='mso-element:header' id=h1>
71
+
72
+ <p class=MsoHeader align=center style='text-align:center;tab-stops:center 3.0in left 4.25in right 6.0in'><span
73
+ style='font-size:10.0pt;font-family:"Arial","sans-serif"'><span
74
+ style='mso-tab-count:1'>����������������������������������������� </span><span
75
+ style='mso-spacerun:yes'>������������ </span></span>Ruby<i style='mso-bidi-font-style:
76
+ normal'>Run</i> Community Edition<span style='font-size:10.0pt;font-family:
77
+ "Arial","sans-serif"'><span style='mso-tab-count:1'> </span><span
78
+ style='mso-spacerun:yes'>����������������������������� </span></span><b
79
+ style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
80
+ coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
81
+ filled="f" stroked="f">
82
+ <v:stroke joinstyle="miter"/>
83
+ <v:formulas>
84
+ <v:f eqn="if lineDrawn pixelLineWidth 0"/>
85
+ <v:f eqn="sum @0 1 0"/>
86
+ <v:f eqn="sum 0 0 @1"/>
87
+ <v:f eqn="prod @2 1 2"/>
88
+ <v:f eqn="prod @3 21600 pixelWidth"/>
89
+ <v:f eqn="prod @3 21600 pixelHeight"/>
90
+ <v:f eqn="sum @0 0 1"/>
91
+ <v:f eqn="prod @6 1 2"/>
92
+ <v:f eqn="prod @7 21600 pixelWidth"/>
93
+ <v:f eqn="sum @8 21600 0"/>
94
+ <v:f eqn="prod @7 21600 pixelHeight"/>
95
+ <v:f eqn="sum @10 21600 0"/>
96
+ </v:formulas>
97
+ <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
98
+ <o:lock v:ext="edit" aspectratio="t"/>
99
+ </v:shapetype><v:shape id="_x0000_i1039" type="#_x0000_t75" style='width:114pt;
100
+ height:20.25pt'>
101
+ <v:imagedata src="image022.png" o:title="rubysophic_logo"/>
102
+ </v:shape><![endif]--></b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
103
+
104
+ </div>
105
+
106
+ <div style='mso-element:footer' id=f1>
107
+
108
+ <p class=MsoFooter align=center style='text-align:center'><span
109
+ style='font-size:10.0pt;font-family:"Arial","sans-serif"'><span
110
+ style='mso-tab-count:1'>������������������������������������������������� </span></span>Installation
111
+ and User Guide<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><span
112
+ style='mso-tab-count:1'>������������������������������� </span></span>Page <!--[if supportFields]><span
113
+ style='mso-element:field-begin'></span><span
114
+ style='mso-spacerun:yes'>�</span>PAGE <span style='mso-element:field-separator'></span><![endif]--><span
115
+ style='mso-no-proof:yes'>1</span><!--[if supportFields]><span style='mso-element:
116
+ field-end'></span><![endif]--> of <!--[if supportFields]><span
117
+ style='mso-element:field-begin'></span><span
118
+ style='mso-spacerun:yes'>�</span>NUMPAGES <span style='mso-element:field-separator'></span><![endif]--><span
119
+ style='mso-no-proof:yes'>1</span><!--[if supportFields]><span style='mso-element:
120
+ field-end'></span><![endif]--><b style='mso-bidi-font-weight:normal'><o:p></o:p></b></p>
121
+
122
+ </div>
123
+
124
+ <div style='mso-element:header' id=fh1>
125
+
126
+ <p class=MsoHeader style='tab-stops:center 3.0in left 310.5pt right 6.0in'><b
127
+ style='mso-bidi-font-weight:normal'><!--[if gte vml 1]><v:shape id="_x0000_i1040"
128
+ type="#_x0000_t75" style='width:110.25pt;height:20.25pt'>
129
+ <v:imagedata src="image022.png" o:title="rubysophic_logo"/>
130
+ </v:shape><![endif]--><span style='mso-tab-count:2'>������������������������������������������������������������������ </span></b><span
131
+ style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Ruby<i
132
+ style='mso-bidi-font-style:normal'>Run</i><sup>CE</sup> 0.9 Installation and
133
+ User Guide<o:p></o:p></span></p>
134
+
135
+ <p class=MsoHeader><o:p>&nbsp;</o:p></p>
136
+
137
+ </div>
138
+
139
+ </body>
140
+
141
+ </html>
@@ -0,0 +1,132 @@
1
+ #---------------------------------------------------------------#
2
+ # #
3
+ # (C) Copyright Rubysophic Inc. 2007-2008 #
4
+ # All rights reserved. #
5
+ # #
6
+ # Use, duplication or disclosure of the code is not permitted #
7
+ # unless licenced. #
8
+ # #
9
+ # Last Updated: 7/09/08 #
10
+ #---------------------------------------------------------------#
11
+ # #
12
+ # The master copy of this property file should have been #
13
+ # installed via the RubyRun gem install package in the #
14
+ # same directory where rubyrun.rb is. #
15
+ # #
16
+ # However, the one that is to be used at run time is the one #
17
+ # either in #
18
+ # 1) the current working directiory under which the application#
19
+ # is running, or #
20
+ # 2) in RubyRun working directory, pointed to by the #
21
+ # the environment variable RUBYRUN_WORKING_DIR (lower priority)#
22
+ # #
23
+ # ************************************************************ #
24
+ # * IN ALL HASH SPECIFICATION, A SPACE MUST BE PLACED * #
25
+ # * AFTER THE COLON AND BEFORE THE VALUES. * #
26
+ # ************************************************************ #
27
+ # #
28
+ #---------------------------------------------------------------#
29
+
30
+ # A source for application candidate classes or modules must
31
+ # be identifed for instrumentation. These classes/modules should
32
+ # be part of your application and not the Ruby or Rails libraries.
33
+ #
34
+ # APP_PATHS must be an array of directories (absolute path)
35
+ # from where ruby code is to be loaded in order to run the
36
+ # application. RubyRun will recursively expand these directories
37
+ # and open every .rb file looking for Class or Module
38
+ # statements. These Class or Module names will be noted as
39
+ # candiates for instrumentation.
40
+ APP_PATHS: []
41
+
42
+ # INCLUDE_HASH is a hash keyed on a class name with an array
43
+ # of method names as values. Class name and method name must be a
44
+ # string but names are case insensitive. This hash identifies
45
+ # class/method combination explicitly that are to be instrumented
46
+ # IN ADDITION to APP_PATHS.
47
+ # Examples:
48
+ # INCLUDE_HASH: {Class1: [method1, method2]}
49
+ # #=> method1 and method2 of Class1
50
+ # INCLUDE_HASH: {Class1: []} #=> all methods in Class1
51
+ # INCLUDE_HASH: {*: [method1]} #=> method1 of any classes
52
+ # INCLUDE_HASH: {} #=> Include nothing extra
53
+ INCLUDE_HASH: {}
54
+
55
+ # EXCLUDE_HASH is a hash keyed on a class name with an array
56
+ # of method names as values. Class name and method name must be a
57
+ # string but names are case insensitive. This hash identifies
58
+ # class/method combinations that are to be excluded from instrumented.
59
+ # Examples:
60
+ # EXCLUDE_HASH: {Class1: [method1, method2]}
61
+ # #=> method1 and method2 of Class1
62
+ # EXCLUDE_HASH: {Class1: []} #=> all methods in Class1
63
+ # EXCLUDE_HASH: {*: [method1]} #=> method1 of any classes
64
+ # EXCLUDE_HASH: {} #=> Exclude nothing
65
+ EXCLUDE_HASH: {}
66
+
67
+ # Specify one of the following to get database I/O timings and sql statements
68
+ # in method trace.
69
+ # For Mysql: { ActiveRecord::ConnectionAdapters::MysqlAdapter: [execute] }
70
+ # For Progres: { ActiveRecord::ConnectionAdapters::PostgreSQLAdapter: [execute] }
71
+ # For SQLite: { ActiveRecord::ConnectionAdapters::SQLiteAdapter: [execute] }
72
+ # For SQLite2: { ActiveRecord::ConnectionAdapters::SQLite2Adapter: [execute] }
73
+ # For Firebird: { ActiveRecord::ConnectionAdapters::FirebirdAdapter: [execute] }
74
+ # For SQLServer: { ActiveRecord::ConnectionAdapters::SQLServerAdapter: [execute] }
75
+ # For OpenBase: { ActiveRecord::ConnectionAdapters::OpenBaseAdapter: [execute] }
76
+ # For FrontBase: { ActiveRecord::ConnectionAdapters::FrontBaseAdapter: [execute] }
77
+ DB_ADAPTER_HASH: {ActiveRecord::ConnectionAdapters::MysqlAdapter: [execute]}
78
+
79
+ # Specify how tracing is to be done.
80
+ # Examples:
81
+ # TRACE_HASH: {*: []} #=> Trace all instrumented methods:
82
+ # TRACE_HASH: {} #=> Stop tracing
83
+ # TRACE_HASH: {Class1: [method1, method2], Class2: [method3, method4]}
84
+ # #=> Trace only these instrumented methods
85
+ TRACE_HASH: {}
86
+
87
+ # Only applies when TRACE_HASH is not an empty hash.
88
+ # Use DEBUG_ARGS to inspect arguments that were passed in method calls.
89
+ # This can slow down execution and affect memory
90
+ # footprint tremendously, and inspecting large argument objects can
91
+ # frequently causes "stack level too deep" error.
92
+ # Turn this on only as a last resort to debug with trace.
93
+ DEBUG_ARGS: false
94
+
95
+ # Only applies when TRACE_HASH is not an empty hash.
96
+ # Use DEBUG_OBJ to inspect objects that made the method call.
97
+ # This can slow down execution and affect memory
98
+ # footprint tremendously, and inspecting large objects can
99
+ # frequently causes "stack level too deep" error.
100
+ # Turn this on only as a last resort to debug with trace.
101
+ DEBUG_OBJ: false
102
+
103
+ # Set Dynamic Application Discovery to true if you want to log
104
+ # the name of the classes and methods that are dynamically added
105
+ # to the Ruby process.
106
+ DAD: true
107
+
108
+ # Set the report timer in second(s). Used by the report
109
+ # thread to wake up every so often to generate the performance report
110
+ # Max value allowed: 3600
111
+ # Min value allowed: 60
112
+ REPORT_TIMER: 60
113
+
114
+ # Set the max no. of RSS reports to be kept before the oldest
115
+ # report is shifted and purged.
116
+ # Max value allowed: 120
117
+ # Min value allowed: 1
118
+ REPORT_SHIFT_AGE: 60
119
+
120
+ # Select reports. The following reports are available:
121
+ # 1. perf_summary - Performance summary in RSS format
122
+ # 2. txn_log - Transaction log in CSV format
123
+ # Examples:
124
+ # OUTPUT: [perf_summary]
125
+ # OUTPUT: [perf_summary, txn_log]
126
+ OUTPUT: [perf_summary, txn_log]
127
+
128
+ # Set the location of the RSS channel and item files
129
+ # Leave this to blank results in [application directory]/public/rubyrun_rss being used
130
+ RSS_PATH:
131
+
132
+
data/ext/extconf.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile("rubyrunnative__")
4
+
Binary file
@@ -0,0 +1,154 @@
1
+ /****************************************************************
2
+ # #
3
+ # (C) Copyright Rubysophic Inc. 2007-2008 #
4
+ # All rights reserved. #
5
+ # #
6
+ # Use, duplication or disclosure of the code is not permitted #
7
+ # unless licensed. #
8
+ # #
9
+ # Last Updated: 5/24/08 #
10
+ ****************************************************************/
11
+
12
+ /*
13
+ This piece of native code relies on the Thread Struct which is part of
14
+ eval.c in the source code directory of the Ruby install.
15
+
16
+ Other structs also exist in the directory as independent .h files but not
17
+ Thread Struct.
18
+
19
+ This means it will require separate dev work and compilation for each
20
+ platform of Ruby and release, in theory.
21
+
22
+ This piece of code follows the dev convention for writing Ruby extension.
23
+
24
+ To compile, use nmake in rubyrunnative subdirectory.
25
+ e.g. >nmake
26
+
27
+ Also, you need to imbed the manifest into the .so file afterwards as follow:
28
+ e.g. >mt.exe -manifest rubyrunnative__.so.manifest -outputresource:rubyrunnative__.so;2
29
+
30
+ Then copy rubyrunnative__.so into the directory where rubyrun.rb is loaded from.
31
+ */
32
+
33
+ #include "rubyrunnative__.h"
34
+
35
+ static VALUE RubyRunNative__;
36
+
37
+ VALUE getTopThreadStack(rb_thread_t thrObj)
38
+ {
39
+ char buf[BUFSIZ];
40
+ VALUE stack_trace;
41
+ NODE *n;
42
+ struct FRAME *frame;
43
+
44
+ /*
45
+ Input is the thread struct pointer.
46
+
47
+ The stack for each frame starts from the thread. Frame consists of the function name (last_func).
48
+
49
+ Node is pointed by each frame, which gives you the name of the file (n->nd_file) and
50
+ the line number (nd_line(n)).
51
+
52
+ For each line there may be multiple functions and dont have the granularity to list them all out.
53
+ We will only list the last one.
54
+
55
+ For the top of the stack (frame pointed to by the thread) we will list the actual function being
56
+ executed on the line #.
57
+
58
+ All the stack entries are returned to the caller as an array.
59
+
60
+ Refer to backtrace(lev) in eval.c. This serves the basis of the following code in terms of
61
+ navigating frames and nodes.
62
+
63
+ However, further testing indicates that the frames/nodes navigation is not reliable unless the
64
+ thread that is being interrogated is the ACTIVE one. It is therefore intended for this fuction
65
+ to return only the data stored in the thread struct.
66
+
67
+ Added: we dont want to kill a thread joined by the main thread, as killing it will kill the
68
+ main thread too, which does not have the begin-rescue clause and will simply terminate the
69
+ entire space with no trace.
70
+ */
71
+ frame = thrObj->frame;
72
+ n = thrObj->node;
73
+ stack_trace = rb_ary_new();
74
+
75
+ if (frame && n) {
76
+ char *funcName =
77
+ (frame->orig_func != NULL)? rb_id2name(frame->orig_func): NULL;
78
+
79
+ if(funcName == NULL)
80
+ funcName = "";
81
+
82
+ if (thrObj->join) {
83
+
84
+ snprintf(buf, BUFSIZ, "%s:%d:%s joined **%x**",
85
+ n->nd_file, nd_line(n),
86
+ funcName,
87
+ thrObj->join->thread);
88
+ /* printf("%s:%d:%s joined **%x**\n", n->nd_file, nd_line(n), rb_id2name(frame->orig_func), thrObj->join->thread); */
89
+ }
90
+ else {
91
+ snprintf(buf, BUFSIZ, "%s:%d:%s",
92
+ n->nd_file, nd_line(n),
93
+ funcName);
94
+ /* printf("%s:%d:%s\n", n->nd_file, nd_line(n), rb_id2name(frame->orig_func)); */
95
+ }
96
+ }
97
+
98
+ rb_ary_push(stack_trace, rb_str_new2(buf));
99
+ return stack_trace;
100
+ }
101
+
102
+ /*
103
+ This c routine implements RubyRunNative__.get_all_top_stacks (static method).
104
+ For each thread in the space, it calls call_stack to simulate a Ruby caller
105
+ invocation.
106
+ */
107
+
108
+ VALUE c_getAllThreadTopStacks(VALUE self)
109
+ {
110
+ VALUE all_top_stack_trace;
111
+ VALUE currThreadID;
112
+ rb_thread_t thrObj, currThreadObj;
113
+
114
+ /*
115
+ We start with the current thread, whatever it is (likely main),
116
+ and use the macro to locate its structure (rb_thread_current only
117
+ returns the thread ID)
118
+ */
119
+ currThreadID = rb_thread_current();
120
+ Data_Get_Struct(currThreadID, struct rb_thread, currThreadObj);
121
+
122
+ /*
123
+ Final result is a hash where the key is the thread ID and value
124
+ an array of stack trace entries.
125
+ */
126
+ all_top_stack_trace = rb_hash_new();
127
+
128
+ /*
129
+ Starts the loop without the dump thread itself.
130
+ Thread structs are double linked list in Ruby. We can start from any one
131
+ and chain through the rest of them.
132
+ */
133
+ thrObj = currThreadObj;
134
+
135
+ for ( ;thrObj ;thrObj = thrObj->next) {
136
+ /* printf("Ruby thread id = %x\n", thrObj->thread); */
137
+ if(thrObj != NULL) {
138
+ rb_hash_aset(all_top_stack_trace, thrObj->thread, getTopThreadStack(thrObj));
139
+ }
140
+
141
+ // If we reached the start point, break.
142
+ // Note: Threads are double linked objects
143
+
144
+ if (thrObj->next == currThreadObj) break;
145
+ }
146
+
147
+ return all_top_stack_trace;
148
+ }
149
+
150
+ void Init_rubyrunnative__()
151
+ {
152
+ RubyRunNative__ = rb_define_class("RubyRunNative__",rb_cObject);
153
+ rb_define_singleton_method(RubyRunNative__, "get_all_top_stacks", c_getAllThreadTopStacks, 0);
154
+ }
@@ -0,0 +1,2 @@
1
+ EXPORTS
2
+ Init_rubyrunnative__
@@ -0,0 +1,36 @@
1
+ /****************************************************************
2
+ # #
3
+ # (C) Copyright Rubysophic Inc. 2007-2008 #
4
+ # All rights reserved. #
5
+ # #
6
+ # Use, duplication or disclosure of the code is not permitted #
7
+ # unless licensed. #
8
+ # #
9
+ # Last Updated: 5/24/08 #
10
+ ****************************************************************/
11
+
12
+ #include "ruby.h"
13
+ #include "env.h"
14
+ #include "node.h"
15
+ #include "st.h"
16
+ #include "setjmp.h"
17
+
18
+ #define SAVE_WIN32_EXCEPTION_LIST
19
+
20
+ #if defined(__cplusplus)
21
+ extern "C" {
22
+ #endif
23
+
24
+ // Main entry method
25
+
26
+ void Init_rubyrunnative__();
27
+
28
+ static VALUE c_getAllThreadTopStacks(VALUE self);
29
+
30
+ // Helper methods
31
+ static VALUE getTopThreadStack(rb_thread_t thrObj);
32
+
33
+
34
+ #if defined(__cplusplus)
35
+ } // extern "C"
36
+ #endif
Binary file
Binary file