README in tracepoint-1.0.0 vs README in tracepoint-1.1

- old
+ new

@@ -1,52 +1,80 @@ -= Tracepoint += TracePoint -* http://death.rubyforge.org -* http://death.rubyforge.org/tracepoint +* http://rubyworks.github.com/tracepoint +* http://github.com/rubyworks/tracepoint -== DESCRIPTION: -A TracePoint is a Binding with the addition of event information. -Among other things, it functions very well as the join-point for AOP. -In practice it provides a better means than #set_trace_func. +== DESCRIPTION -== FEATURES/PROBLEMS: +TracePoint is a Binding with the addition of event information. +In theory it would function very well as the join-point for AOP. +In practice it provides a better approach to #set_trace_func. -* Easier and more versitle than #set_trace_func. -* Set mutliple traces easily. -== RELEASE/NOTES: +== FEATURES -Please see RELEASE file. +* More versitle than #set_trace_func. +* Easy to set mutliple traces. -== SYNOPSIS: -Let's watch everything that happens: +== SYNOPSIS - TracePoint.trace { |tp| - puts "#{tp.self.class}\t#{tp.called}\t#{tp.event}\t#{tp.return?}\t#{tp.back == tp.bind}" - } +Using TracePoint is simply a matter of setting the #trace procedure. +For example to watch everything that happens during a Ruby process: + TracePoint.trace do |tp| + puts "#{tp.self.class}\t#{tp.callee}\t#{tp.event}\t#{tp.return?}" + end + + TracePoint.activate + 1 + 1 -produces +Produces: - Class trace return true false - Object line false false - Fixnum + c-call false false - Fixnum + c-return false false + Object line false + Fixnum + c-call false + Fixnum + c-return false -See RDocs for more information. +Tracing can be deactived and reactivates on the fly by calling #deactivate +and #activate. -== INSTALL: +To add an additional trace procedure, simple call the #trace method again. +Trace procedures can also be nameed by providing a name argument to the +#trace method. This allows traces to be added and removed without affecting +other traces. -* sudo gem install tracepoint + TracePoint.trace(:class_trace) do |tp| + puts tp.self.class + end -== LICENSE: + TracePoint.trace(:method_trace) do |tp| + puts tp.callee + end + # ... + + TracePoint.clear(:class_trace) + +Calling #clear with no arguments will remove all trace procedures and +deactivate tracing. + +Please see the API documentation for more information. + + +== INSTALLATION + +Follow the usual procedure for installing via RubyGems: + + $ sudo gem install tracepoint + + +== LICENSE + (LGPL v3 License) -Copyright (c) 2005,2009 The Coding Dead <death.rubyforge.org> +Copyright (c) 2005,2009 Thomas Sawyer This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.