38
39
40
41
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/mosaik/commands/identify.rb', line 38
def call
info "Identifying microservice candidates (#{options.map { |k, v| "#{k}: #{v}" }.join(', ')})"
Graph::Reducer
.new(options, graph)
.call
RubyProf.start if options[:profile]
time = Time.measure do
Algorithms
.const_get(options[:algorithm].camelize)
.new(options, graph)
.tap(&:validate)
.call
end
if options[:profile]
profile = RubyProf.stop
printer = RubyProf::FlameGraphPrinter.new(profile)
printer.print(File.open("profile.html", "w+"))
info "Profiling information written to profile.html"
end
info "Executed algorithm in #{time} seconds"
graph.clusters.each_value do |cluster|
debug "Cluster #{cluster.id}"
cluster.vertices.each do |vertex|
debug " #{vertex.id}"
end
end
write_graph
visualize_graph
end
|