Permalink
Browse files

Support as a gem plugin. Changed README to markdown format.

  • Loading branch information...
1 parent c3fc23d commit 77431bf3cc9d48e7eb40329d10a32294f0673e89 @ph7 committed Nov 17, 2008
Showing with 106 additions and 75 deletions.
  1. +0 −65 README
  2. +95 −0 README.markdown
  3. +3 −3 Rakefile
  4. +2 −0 lib/xray.rb
  5. +3 −3 lib/xray/dtrace/rails/enable_tracing.rb
  6. +0 −2 lib/xray/xray.rb
  7. +2 −0 rails/init.rb
  8. +1 −2 test/test_helper.rb
View
65 README
@@ -1,65 +0,0 @@
-= XRay
-
-* http://rubyforge.org/projects/xray
-
-== Description
-
-XRay provides a lightweight yet powerful toolbox for troubleshooting Ruby
-applications when things stop making sense. XRay includes GDB and DTrace
-tooling as well as a Thread Dump utility that can dump the stack trace
-of all the thread in your Ruby VM when you send a +QUIT+ signal.
-
-== GDB
-
-Copy the +gdb_macros+ file provided in the gem as your ~/.gdbinit file.
-You will find more details on how to use them, in my
-{Troubleshooting Ruby Shortcut}[http://ph7spot.com/publications/troubleshooting_ruby_processes]
-
-== Thread Dump
-
-After patching your Ruby VM with {caller_for_all_threads_patch_for_MRI_1.8.6.diff}[http://xray.rubyforge.org/svn/patches_for_mri/caller_for_all_threads_patch_for_MRI_1.8.6.diff]
-(or {caller_for_all_threads_patch_for_MRI_1.8.7.diff}[http://xray.rubyforge.org/svn/patches_for_mri/caller_for_all_threads_patch_for_MRI_1.8.7.diff])
-as explained in {this document}[http://ph7spot.com/caller_for_all_threads], you can install a signal
-handler in charge of dumping the stack trace for all the threads
-in your Ruby VM with:
-
- require "rubygems"
- require "xray/thread_dump_signal_handler"
-
-You can then trigger a thread dump at any time with
-
- kill -QUIT <pid of your ruby process>
-
-== DTrace
-
-=== Fire DTrace Application Probes
-
-See XRay::DTrace::Tracer
-
-=== Out-of-the-box Rails DTrace Instrumentation ***
-
-You are one require away from triggering automatically DTrace events for
-Rails requests, database access and template rendering. As simple as
-
- # environment.rb
- Rails::Initializer.run do |config|
-
- ...
-
- config.after_initialize do
- require "rubygems"
- require "xray/dtrace/rails/enable_tracing"
- end
- end
-
-See
-* lib/xray/dtrace/railsenable_tracing.rb
-* lib/xray/dtrace/action_controller_tracing_extension.rb
-* lib/xray/dtrace/active_record_tracing_extension.rb
-
-
-== Author
-
-Philippe Hanrigou,
-http://ph7spot.com
-
View
@@ -0,0 +1,95 @@
+XRay
+====
+
+Description
+-----------
+
+ XRay provides a lightweight yet powerful toolbox for troubleshooting Ruby
+ applications when things stop making sense. XRay includes GDB and DTrace
+ tooling, as well as a Thread Dump utility that can dump the stack trace
+ of _all_ the threads in your Ruby VM when you send a +QUIT+ signal.
+
+
+* Source: http://github.com/ph7/xray/tree/master
+* Project: http://rubyforge.org/projects/xray
+* API: http://xray.rubyforge.org
+
+GDB Instrumentation
+-------------------
+
+ Copy the +gdb_macros+ file provided in the gem as your ~/.gdbinit file
+ and you can access Ruby level and C level information at the same time!
+ Invaluable to find tough problems on platforms where DTrace is not
+ available. You can find more details on how to use the gdb macros, in the
+ [Troubleshooting Ruby Processes][http://ph7spot.com/publications/troubleshooting_ruby_processes].
+
+Thread Dump for All Threads
+---------------------------
+
+ On an [caller_for_all_threads](http://ph7spot.com/caller_for_all_threads)
+ enabled Ruby interpreter, you can install the XRay signal handler
+ to dumping the stack trace for _all_ the threads in your Ruby VM with:
+
+ require "rubygems"
+ require "xray/thread_dump_signal_handler"
+
+ You can trigger a thread dump at any time with
+
+ kill -QUIT <pid of your ruby process>
+
+DTrace
+------
+
+### Collection of D scripts ###
+
+ Installed under /usr/bin, they all start with `xray_`
+
+ ### Out-of-the-box Rails DTrace Instrumentation ###
+
+ You are one require away from triggering automatically DTrace events for
+ Rails requests, database access and template rendering. As simple as
+
+ # environment.rb
+ Rails::Initializer.run do |config|
+
+ ...
+
+ config.after_initialize do
+ require "rubygems"
+ require "xray/dtrace/rails/enable_tracing"
+ end
+ end
+
+ If (like me) yo like gem plugins. Or
+
+ # environment.rb
+ Rails::Initializer.run do |config|
+
+ ...
+
+ config.after_initialize do
+ require "rubygems"
+ require "xray/dtrace/rails/enable_tracing"
+ end
+ end
+
+ if you prefer tighter control.
+
+ You then get the following DTrace probes
+
+ See
+ * `lib/xray/dtrace/rails/enable_tracing.rb`
+ * `lib/xray/dtrace/rails/action_controller_tracing_extension.rb`
+ * `lib/xray/dtrace/rails/active_record_tracing_extension.rb`
+
+### Fire Your Own Application-Specific DTrace Probes ###
+
+ See [XRay::DTrace::Tracer](http://github.com/ph7/xray/tree/master/lib/xray/dtrace/tracer.rb)
+ for more details or look at an [custom instrumentation example](http://github.com/ph7/xray/tree/master/examples/dtrace/simple_ruby_script_with_tracer_custom_dtrace_instrumentation.rb).
+
+
+== Author
+
+Philippe Hanrigou,
+http://ph7spot.com
+
View
@@ -33,7 +33,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
end
specification = Gem::Specification.new do |s|
- s.name = "XRay"
+ s.name = "xray"
s.summary = "Dump backtrace for all threads."
s.version = "1.1"
s.author = "Philippe Hanrigou"
@@ -42,8 +42,8 @@ specification = Gem::Specification.new do |s|
s.rubyforge_project = 'xray'
s.platform = Gem::Platform::RUBY
s.executables = FileList['bin/**/*'].collect {|path| path.sub /bin\//, ""}
- s.files = FileList['lib/**/*.rb'] + FileList['test/**/*.rb'] +
- FileList['**/*.diff'] +
+ s.files = FileList['lib/**/*.rb'] + FileList['test/**/*.rb'] + FileList['examples/**/*'] +
+ FileList['**/*.diff'] + [ "rails/init.rb"]
[ 'gdb_macros', 'Rakefile' ]
s.require_path = "lib"
s.extensions = []
View
@@ -0,0 +1,2 @@
+require File.dirname(__FILE__) + '/xray/thread_dump_signal_handler'
+require File.dirname(__FILE__) + '/xray/dtrace/tracer'
@@ -13,13 +13,13 @@
# end
# end
-require 'xray/dtrace/tracer'
+require File.expand_path(File.dirname(__FILE__) + '/../tracer')
if Object.const_defined? :ActionController
puts "XRay: Enabling Rails Controller Tracing"
- require "xray/dtrace/rails/action_controller_tracing_extension"
+ require File.expand_path(File.dirname(__FILE__) + "/../rails/action_controller_tracing_extension")
end
if Object.const_defined? :ActiveRecord
puts "XRay: Enabling Rails DB Tracing"
- require "xray/dtrace/rails/active_record_connection_tracing_extension"
+ require File.expand_path(File.dirname(__FILE__) + "/../rails/active_record_connection_tracing_extension")
end
View
@@ -1,2 +0,0 @@
-require 'xray/thread_dump_signal_handler'
-require 'xray/dtrace/tracer'
View
@@ -0,0 +1,2 @@
+require File.dirname(__FILE__) + '/../lib/xray'
+require File.dirname(__FILE__) + '/../lib/xray/dtrace/rails/enable_tracing'
View
@@ -1,7 +1,6 @@
$: << File.dirname(__FILE__) + '/../ext/xray'
$: << File.dirname(__FILE__) + '/../lib'
-require 'xray/xray'
-require 'xray/dtrace/tracer'
+require 'xray'
require 'test/unit'
require 'rubygems'

0 comments on commit 77431bf

Please sign in to comment.