Class: VizHelper

Inherits:
Object
  • Object
show all
Includes:
Bud, TraceCardinality
Defined in:
lib/bud/viz_util.rb

Constant Summary

Constant Summary

Constants included from Bud

Bud::VERSION

Instance Attribute Summary

Attributes included from Bud

#app_tables, #budtime, #builtin_tables, #channels, #dbm_tables, #done_bootstrap, #dsock, #inbound, #inside_tick, #lattices, #merge_targets, #meta_parser, #metrics, #options, #periodics, #push_elems, #push_joins, #push_sources, #qualified_name, #rtracer, #running_async, #scanners, #stratified_rules, #tables, #this_rule_context, #this_stratum, #viz, #zk_tables

Instance Method Summary collapse

Methods included from Bud

#accum, #accum_pair, #async_do, #avg, #bool_and, #bool_or, #bootstrap, #bud_clock, #cancel_shutdown_cb, #channel, #choose, #choose_rand, #coll_expr, #collection_stratum, #count, #delta, #do_bootstrap, #do_invalidate_rescan, #do_register_callback, #file_reader, #import_instance, #input, #inspect, #int_ip_port, #interface, #interfaces, #ip, #ip_port, #load_lattice_defs, #loopback, #max, #min, #module_wrapper_class, #on_shutdown, #output, #pause, #periodic, #port, #post_shutdown, #readonly, #register_callback, #run_bg, #run_fg, #scratch, #singleton_class, #start, #stop, #store, #sum, #sync, #sync_callback, #sync_do, #table, #temp, #terminal, #tick, #tick_internal, #toplevel, #toplevel?, #unregister_callback, #wiring?

Constructor Details

#initialize(tabinf, cycle, depends, rules, dir, provides) ⇒ VizHelper

Returns a new instance of VizHelper



23
24
25
26
27
28
29
30
31
# File 'lib/bud/viz_util.rb', line 23

def initialize(tabinf, cycle, depends, rules, dir, provides)
  @t_tabinf = tabinf
  @t_cycle = cycle
  @t_depends = depends
  @t_rules = rules
  @t_provides = provides
  @dir = dir
  super()
end

Instance Method Details

#summarize(dir, schema) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/bud/viz_util.rb', line 33

def summarize(dir, schema)
  table_io = {}
  cardinalities.to_a.sort{|a, b| a[0] <=> b[0]}.each do |card|
    table_io["#{card.table}_#{card.bud_time}"] = start_table(dir, card.table, card.bud_time, schema[card.table])
  end

  full_info.each do |info|
    write_table_content(table_io["#{info.table}_#{info.bud_time}"], info.row)
  end

  table_io.each_value do |tab|
    end_table(tab)
  end

  # fix: nested loops
  times.to_a.sort.each do |time|
    card_info = {}
    cardinalities.each do |card|
      if card.bud_time == time.bud_time
        card_info[card.table] = card.cnt
      end
    end

    d = "#{@dir}/tm_#{time.bud_time}"
    write_graphs(@t_tabinf, builtin_tables, @t_cycle, @t_depends, @t_rules, d,
                 @dir, nil, false, nil, time.bud_time, card_info)
  end
end