Sha256: 1ccb35aee29f56d87e2e30e3ad5c102ca3b159280f197a068b2b3789e2421894
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
# # Install a signal handler to dump backtraces for all threads # # Trigger it with: kill -QUIT <pid> # trap "QUIT" do if Kernel.respond_to? :caller_for_all_threads STDERR.puts "\n=============== XRay - Thread Dump ===============" caller_for_all_threads.each_pair do |thread, stack| thread_description = thread.inspect thread_description << " [main]" if thread == Thread.main thread_description << " [current]" if thread == Thread.current thread_description << " alive=#{thread.alive?}" thread_description << " priority=#{thread.priority}" thread_separator = "-" * 78 full_description = "\n#{thread_separator}\n" full_description << thread_description full_description << "\n#{thread_separator}\n" full_description << " #{stack.join("\n \\_ ")}\n" # Single puts to avoid interleaved output STDERR.puts full_description end else STDERR.puts "=============== XRay - Current Thread Backtrace ===============" STDERR.puts "Current thread : #{Thread.inspect}" STDERR.puts caller.join("\n \\_ ") end STDERR.puts "\n=============== XRay - Done ===============\n" end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
XRay-1.0.3 | lib/xray/thread_dump_signal_handler.rb |
xray-1.1 | lib/xray/thread_dump_signal_handler.rb |