Class: TraceTree

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_tree.rb,
lib/trace_tree/args.rb,
lib/trace_tree/warm.rb,
lib/trace_tree/color.rb,
lib/trace_tree/point.rb,
lib/trace_tree/point.rb,
lib/trace_tree/timer.rb,
lib/trace_tree/config.rb,
lib/trace_tree/version.rb,
lib/trace_tree/tmp_file.rb,
lib/trace_tree/gem_paths.rb,
lib/trace_tree/point/omit.rb,
lib/trace_tree/point/common.rb,
lib/trace_tree/return_value.rb,
lib/trace_tree/tree_htmlable.rb,
lib/trace_tree/short_gem_path.rb,
lib/trace_tree/tree_graphable.rb,
lib/trace_tree/point/threadend.rb,
lib/trace_tree/point/threadbegin.rb,
lib/trace_tree/points_markdown_table.rb,
lib/trace_tree/point/ccall_kernel_raise.rb,
lib/trace_tree/point/ccall_kernel_extend.rb,
lib/trace_tree/point/ccall_module_include.rb,
lib/trace_tree/point/ccall_module_prepend.rb,
lib/trace_tree/point/ccall_classthread_new.rb,
lib/trace_tree/point/ccall_thread_initialize.rb,
lib/trace_tree/point/creturn_classthread_new.rb,
lib/trace_tree/point/ccall_module_extendobject.rb,
lib/trace_tree/point/creturn_thread_initialize.rb,
lib/trace_tree/point/creturn_module_extendobject.rb

Defined Under Namespace

Modules: Args, Color, ConsoleReturnValue, LuxuryReturnValue, ReturnValue, ShortGemPath, TreeGraphable, TreeHtmlable, Warm Classes: Config, Point, PointsMarkdownTable, Timer, TmpFile

Constant Summary collapse

MainFile =
__FILE__
Events =
[:b_call, :b_return,
:c_call, :c_return,
:call, :return,
:class, :end,
:thread_begin, :thread_end]
VERSION =
"0.3.4"
GemPaths =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bi) ⇒ TraceTree

Returns a new instance of TraceTree.



35
36
37
38
39
40
# File 'lib/trace_tree.rb', line 35

def initialize bi
  @bi = bi
  @trace_points = Queue.new
  @timer = Timer.new
  @config = Config.load
end

Class Method Details

.tmpObject



6
7
8
# File 'lib/trace_tree/tmp_file.rb', line 6

def tmp
  Dir.tmpdir
end

Instance Method Details

#generate(*log, **opt, &to_do) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/trace_tree.rb', line 42

def generate *log, **opt, &to_do
  @opt = opt
  @log = dump_location(*log)
  @debug = debug_location
  enhance_point
  @build_command = (opt[:html] || opt[:htmp]) ? :tree_html_full : :tree_graph
  make_filter
  @__file__, @__line__ = bi.source_location
  there = bi.eval('self')

  dry_run

  #start_trace
  timer[:trace]
  @tp = TracePoint.new(*Events, &@deal)
  @tp.enable

  there.instance_eval(&to_do)
ensure
  #stop_trace
  return unless @tp
  @tp.disable
  timer[:trace]
  dump_trace_tree
end