better_rails_debugger 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/better_rails_debugger/analysis_groups_controller.rb +2 -1
- data/app/controllers/better_rails_debugger/group_instances_controller.rb +44 -2
- data/app/jobs/better_rails_debugger/analysis_recorder_job.rb +3 -0
- data/app/models/better_rails_debugger/analysis_group.rb +4 -0
- data/app/models/better_rails_debugger/group_instance.rb +63 -7
- data/app/models/better_rails_debugger/trace_point_item.rb +11 -0
- data/app/views/better_rails_debugger/analysis_groups/_form.html.haml +18 -1
- data/app/views/better_rails_debugger/analysis_groups/show.html.haml +1 -1
- data/app/views/better_rails_debugger/group_instances/_memory_summary.html.haml +47 -0
- data/app/views/better_rails_debugger/group_instances/_method_summary.html.haml +3 -0
- data/app/views/better_rails_debugger/group_instances/objects.html.haml +3 -1
- data/app/views/better_rails_debugger/group_instances/show.html.haml +35 -0
- data/app/views/better_rails_debugger/group_instances/tracer.html.haml +38 -0
- data/config/routes.rb +1 -0
- data/lib/better_rails_debugger/{memory_analyzer.rb → analyzer.rb} +35 -3
- data/lib/better_rails_debugger/version.rb +1 -1
- data/lib/better_rails_debugger.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db111d53acaca8f9189541d980913115548ad5d
|
4
|
+
data.tar.gz: 3019083b26fc20710e60f1e117c24ed8ab11fb36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2cd39a23ed59ad9287721aba2d9df1aac1848939ce417626f7fa39447846218140359a294d858c510806cffb0c976c183af409d23fc733cba50539be6983702
|
7
|
+
data.tar.gz: 64c5dfab31505814a7ecfa858b662da32fa23620e0c8b857aa35a4065252270be67e4b82bc05f8a6f4fc5ce7470134aed7b004ffda5cfd8f38b9fa97dbe0d69f
|
data/README.md
CHANGED
@@ -84,7 +84,7 @@ class ApplicationController < ActionController::Base
|
|
84
84
|
around_action :do_analysis
|
85
85
|
|
86
86
|
def do_analysis
|
87
|
-
BetterRailsDebugger::
|
87
|
+
BetterRailsDebugger::Analyzer.instance.analyze "#{request.url}", "5a98a93f50f04b079458fd57" do
|
88
88
|
yield
|
89
89
|
end
|
90
90
|
end
|
@@ -65,7 +65,8 @@ module BetterRailsDebugger
|
|
65
65
|
def analysis_group_params
|
66
66
|
params.require(:analysis_group).permit([:name, :collect_memory_information, :analise_memory_in_code,
|
67
67
|
:analise_memory_in_gems, :record_objects_in, :times_to_run,
|
68
|
-
:analyze_repeated_instances
|
68
|
+
:analyze_repeated_instances, :generate_method_execution_history,
|
69
|
+
:calculate_execution_time_of_methods])
|
69
70
|
end
|
70
71
|
|
71
72
|
def get_group
|
@@ -2,6 +2,31 @@ require_dependency "better_rails_debugger/application_controller"
|
|
2
2
|
|
3
3
|
module BetterRailsDebugger
|
4
4
|
class GroupInstancesController < ApplicationController
|
5
|
+
def show
|
6
|
+
begin
|
7
|
+
@instance = GroupInstance.find params[:id]
|
8
|
+
rescue Mongoid::Errors::DocumentNotFound
|
9
|
+
redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
|
10
|
+
return
|
11
|
+
end
|
12
|
+
@most_used_methods = @instance.most_used_methods(4)
|
13
|
+
@file_allocations = @instance.files_with_more_allocations(4)
|
14
|
+
end
|
15
|
+
|
16
|
+
def tracer
|
17
|
+
begin
|
18
|
+
@instance = GroupInstance.find params[:id]
|
19
|
+
rescue Mongoid::Errors::DocumentNotFound
|
20
|
+
redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
|
21
|
+
return
|
22
|
+
end
|
23
|
+
@traces = @instance.trace_point_items.order(created_at: 'desc').limit(20)
|
24
|
+
filter_traces
|
25
|
+
@traces = @traces.paginate(page: (params[:page] || 1), per_page: 20)
|
26
|
+
|
27
|
+
@file_allocations = @instance.files_with_more_allocations(4)
|
28
|
+
end
|
29
|
+
|
5
30
|
def objects
|
6
31
|
begin
|
7
32
|
@instance = GroupInstance.find params[:id]
|
@@ -10,7 +35,7 @@ module BetterRailsDebugger
|
|
10
35
|
return
|
11
36
|
end
|
12
37
|
@objects = @instance.objects.order(created_at: 'desc').limit(20)
|
13
|
-
|
38
|
+
filter_objects
|
14
39
|
@objects = @objects.paginate(page: (params[:page] || 1), per_page: 20)
|
15
40
|
|
16
41
|
@file_allocations = @instance.files_with_more_allocations(4)
|
@@ -31,7 +56,7 @@ module BetterRailsDebugger
|
|
31
56
|
end
|
32
57
|
|
33
58
|
private
|
34
|
-
def
|
59
|
+
def filter_objects
|
35
60
|
if ['asc', 'desc'].include? params[:order] and ['location', 'memsize', 'class'].include? params[:column]
|
36
61
|
if params[:column] == 'location'
|
37
62
|
@objects = @objects.order({source_file: params[:order], source_line: params[:order]})
|
@@ -49,5 +74,22 @@ module BetterRailsDebugger
|
|
49
74
|
pp @objects
|
50
75
|
end
|
51
76
|
end
|
77
|
+
|
78
|
+
def filter_traces
|
79
|
+
if ['asc', 'desc'].include? params[:order] and ['location', 'method', 'times'].include? params[:column]
|
80
|
+
if params[:column] == 'location'
|
81
|
+
@traces = @traces.order({source_file: params[:order], source_line: params[:order]})
|
82
|
+
elsif params[:column] == 'method'
|
83
|
+
@traces = @traces.order({method_id: params[:order]})
|
84
|
+
end
|
85
|
+
end
|
86
|
+
if params[:filter].present?
|
87
|
+
@objects = @objects.or({source_file: /.*#{params[:filter]}.*/i},
|
88
|
+
{source_line: /.*#{params[:filter]}.*/i},
|
89
|
+
{memsize: /.*#{params[:filter]}.*/i},
|
90
|
+
{class_name: /.*#{params[:filter]}.*/i})
|
91
|
+
pp @objects
|
92
|
+
end
|
93
|
+
end
|
52
94
|
end
|
53
95
|
end
|
@@ -14,6 +14,8 @@ module BetterRailsDebugger
|
|
14
14
|
Rails.logger.error "[BetterRailsDebugger AnalysisRecorderJob] GroupInstance '#{recorded[:instance_id]}' not found. Skiping..."
|
15
15
|
return
|
16
16
|
end
|
17
|
+
instance.status = 'processing'
|
18
|
+
instance.save
|
17
19
|
|
18
20
|
# Now, with the group present... we can start to work on it
|
19
21
|
# group = instance.analysis_group
|
@@ -30,6 +32,7 @@ module BetterRailsDebugger
|
|
30
32
|
end
|
31
33
|
instance.allocations_per_file = allocations_per_file.to_json
|
32
34
|
instance.memsize_per_file = memsize_per_file.to_json
|
35
|
+
instance.status = 'finished'
|
33
36
|
instance.save
|
34
37
|
|
35
38
|
end
|
@@ -21,6 +21,10 @@ module BetterRailsDebugger
|
|
21
21
|
field :times_to_run, type: Integer, default: 0 # 0: Infinite
|
22
22
|
field :analyze_repeated_instances, type: Boolean, default: true # if false, Check the identifier and do run the analyzer if already exist one with the same identifier
|
23
23
|
|
24
|
+
## Code execution options
|
25
|
+
field :generate_method_execution_history, type: Boolean, default: false
|
26
|
+
field :calculate_execution_time_of_methods, type: Boolean, default: false
|
27
|
+
|
24
28
|
# Internal use
|
25
29
|
field :analise_paths, type: Array, default: []
|
26
30
|
|
@@ -5,13 +5,14 @@ module BetterRailsDebugger
|
|
5
5
|
|
6
6
|
belongs_to :analysis_group, class_name: "::BetterRailsDebugger::AnalysisGroup"
|
7
7
|
has_many :objects, class_name: "::BetterRailsDebugger::ObjectInformation", inverse_of: :group_instance, dependent: :delete_all
|
8
|
+
has_many :trace_point_items, class_name: "::BetterRailsDebugger::TracePointItem", inverse_of: :group_instance, dependent: :delete_all
|
8
9
|
|
9
10
|
# Basic information
|
10
11
|
field :identifier, type: String
|
11
12
|
field :metadata, type: Hash
|
12
13
|
|
13
14
|
# Status information
|
14
|
-
field :
|
15
|
+
field :status, type: String
|
15
16
|
field :total_classes, type: Integer # Total number of used Classes
|
16
17
|
field :total_memory, type: Integer # Total memory used in bytes
|
17
18
|
field :total_files, type: Integer # Total file used on allocation
|
@@ -21,17 +22,72 @@ module BetterRailsDebugger
|
|
21
22
|
field :allocations_per_file, type: String
|
22
23
|
field :memsize_per_file, type: String
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
## Memory methods
|
26
|
+
|
27
|
+
def memsize_per_file_hash
|
28
|
+
return @memsize_per_file_hash if @memsize_per_file_hash.present?
|
29
|
+
@memsize_per_file_hash = JSON.parse(memsize_per_file.to_s) rescue {}
|
27
30
|
end
|
28
31
|
|
29
|
-
def
|
30
|
-
|
32
|
+
def allocations_per_file_hash
|
33
|
+
return @allocations_per_file if @allocations_per_file.present?
|
34
|
+
@allocations_per_file = JSON.parse(allocations_per_file.to_s) rescue {}
|
31
35
|
end
|
32
36
|
|
33
37
|
def files_that_use_more_memory(n)
|
34
|
-
|
38
|
+
memsize_per_file_hash.to_a.sort_by do |a| a[1] end.reverse[0..n]
|
39
|
+
end
|
40
|
+
|
41
|
+
def files_with_more_allocations(n)
|
42
|
+
allocations_per_file_hash.to_a.sort_by do |a| a[1] end.reverse[0..n]
|
43
|
+
end
|
44
|
+
|
45
|
+
def count_methods
|
46
|
+
return @count_methods if @count_methods
|
47
|
+
@count_methods = Hash.new
|
48
|
+
trace_point_items.each do |item|
|
49
|
+
@count_methods["#{item.source_file}:#{item.source_line}"] ||= {
|
50
|
+
item: item,
|
51
|
+
count: 0
|
52
|
+
}
|
53
|
+
@count_methods["#{item.source_file}:#{item.source_line}"][:count] += 1
|
54
|
+
end
|
55
|
+
@count_methods
|
56
|
+
end
|
57
|
+
|
58
|
+
def most_used_methods(n)
|
59
|
+
count_methods.to_a.sort_by do |a| a[1][:count] end.reverse[0..n].to_h
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return an array of hash file => mem that consume more than 10 MB(default) or ram aprox
|
63
|
+
# TODO: The amount of consumed ram must be configurable
|
64
|
+
def big_files(max_size=10.megabytes)
|
65
|
+
return @big_files if @big_files
|
66
|
+
@big_files = (memsize_per_file_hash || {}).select do |key, size|
|
67
|
+
size >= max_size
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Return an array of hashed that contains some information about the classes that consume more than `max_size` bytess
|
72
|
+
def big_classes(max_size=1.megabytes)
|
73
|
+
return @big_classes if @big_classes
|
74
|
+
@big_classes = {}
|
75
|
+
ObjectInformation.where(:group_instance_id => self.id, :memsize.gt => max_size).all.each do |object|
|
76
|
+
@big_classes[object.class_name] ||= {total_mem: 0, average: 0, count: 0}
|
77
|
+
@big_classes[object.class_name][:total_mem] += object.memsize
|
78
|
+
@big_classes[object.class_name][:count] += 1
|
79
|
+
end
|
80
|
+
@big_classes.each_pair do |klass, hash|
|
81
|
+
@big_classes[klass][:average] = @big_classes[klass][:total_mem] / @big_classes[klass][:count]
|
82
|
+
end
|
83
|
+
@big_classes
|
84
|
+
end
|
85
|
+
|
86
|
+
## Trace point methods
|
87
|
+
|
88
|
+
def track_allocation_of?(path)
|
89
|
+
return true if match_file_list?(path) or called_from_caller_file?(path)
|
90
|
+
false
|
35
91
|
end
|
36
92
|
|
37
93
|
private
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module BetterRailsDebugger
|
2
|
+
class TracePointItem
|
3
|
+
include Mongoid::Document
|
4
|
+
|
5
|
+
belongs_to :group_instance, class_name: "::BetterRailsDebugger::GroupInstance"
|
6
|
+
|
7
|
+
field :source_file, type: String
|
8
|
+
field :source_line, type: Integer
|
9
|
+
field :method_id, type: String
|
10
|
+
end
|
11
|
+
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
= f.text_field :name, min: 3, class: 'form-control form-control-lg col-10'
|
5
5
|
|
6
6
|
%fielset.form-group
|
7
|
-
%legend Settings
|
7
|
+
%legend Memory Settings
|
8
8
|
.form-group.d-flex.justify-content-start
|
9
9
|
= f.label :times_to_run, class: 'col-2'
|
10
10
|
.col-10
|
@@ -37,5 +37,22 @@
|
|
37
37
|
.col-10
|
38
38
|
= f.check_box :analise_memory_in_gems
|
39
39
|
.text-danger.d-inline Analise memory of all gems in the block it's really slow
|
40
|
+
/ Disabled by the moment
|
41
|
+
%fielset.form-group
|
42
|
+
%legend.d-inline
|
43
|
+
Code execution
|
44
|
+
%i.small.d-inline.text-danger
|
45
|
+
(under development, do not enable it yet)
|
46
|
+
.form-group.d-flex.justify-content-start
|
47
|
+
= f.label :generate_method_execution_history, class: 'col-2'
|
48
|
+
.col-10
|
49
|
+
= f.check_box :generate_method_execution_history
|
50
|
+
.text-secondary.d-inline Generate and store the whole backtrace of method executed.
|
51
|
+
|
52
|
+
.form-group.d-flex.justify-content-start
|
53
|
+
= f.label :calculate_execution_time_of_methods, class: 'col-2'
|
54
|
+
.col-10
|
55
|
+
= f.check_box :calculate_execution_time_of_methods
|
56
|
+
.text-secondary.d-inline Generate and store the whole backtrace of method executed.
|
40
57
|
|
41
58
|
%button.btn.btn-primary{:type => "submit"} Confirm
|
@@ -29,7 +29,7 @@
|
|
29
29
|
%tbody
|
30
30
|
- @instances.each do |instance|
|
31
31
|
%tr.d-flex
|
32
|
-
%td.col-8= link_to instance.identifier,
|
32
|
+
%td.col-8= link_to instance.identifier, group_instance_path(instance.id)
|
33
33
|
%th.col-2= instance.created_at.strftime("%c")
|
34
34
|
%td.col-2= link_to "Objects", objects_group_instance_path(instance.id), class: 'btn btn-sm btn-information'
|
35
35
|
= will_paginate @instances, renderer: WillPaginate::ActionView::BootstrapLinkRenderer
|
@@ -0,0 +1,47 @@
|
|
1
|
+
%h4 Memory summary
|
2
|
+
- if @instance.big_files.any?
|
3
|
+
%p
|
4
|
+
There are
|
5
|
+
%i.text-danger
|
6
|
+
= @instance.big_files.size
|
7
|
+
file that you should check.
|
8
|
+
%table.table.border.border-secondary.border-top-0
|
9
|
+
%thead.bg-secondary.text-white
|
10
|
+
%tr.d-flex
|
11
|
+
%th.col-10 File
|
12
|
+
%th.col-2 Memory
|
13
|
+
|
14
|
+
%tbody
|
15
|
+
- @instance.big_files.each do |file, size|
|
16
|
+
%tr.d-flex
|
17
|
+
%td.col-10
|
18
|
+
%span.text-primary
|
19
|
+
= file
|
20
|
+
%td.col-2= number_to_human_size size
|
21
|
+
|
22
|
+
- else
|
23
|
+
%p.text-success Congratulations! all your files looks good!
|
24
|
+
|
25
|
+
- if @instance.big_classes.any?
|
26
|
+
%p
|
27
|
+
There are
|
28
|
+
%i.text-danger
|
29
|
+
= @instance.big_classes.size
|
30
|
+
classes that you should check.
|
31
|
+
|
32
|
+
%table.table.border.border-secondary.border-top-0
|
33
|
+
%thead.bg-secondary.text-white
|
34
|
+
%tr.d-flex
|
35
|
+
%th.col-10 Class
|
36
|
+
%th.col-2 Average memory
|
37
|
+
|
38
|
+
%tbody
|
39
|
+
- @instance.big_classes.each_pair do |klass, hash|
|
40
|
+
%tr.d-flex
|
41
|
+
%td.col-10
|
42
|
+
%span.text-danger
|
43
|
+
= klass
|
44
|
+
%td.col-2= number_to_human_size hash[:average]
|
45
|
+
- else
|
46
|
+
%p.text-success There is no particular class that you should care about.
|
47
|
+
= link_to "Check all objects allocated", objects_group_instance_path(@instance)
|
@@ -22,7 +22,9 @@
|
|
22
22
|
%li.breadcrumb-item
|
23
23
|
%a{:href => analysis_group_path(@instance.analysis_group.id)}= @instance.analysis_group.name
|
24
24
|
%li.breadcrumb-item
|
25
|
-
%a{:href =>
|
25
|
+
%a{:href => group_instance_path(@instance)}= @instance.identifier
|
26
|
+
%li.breadcrumb-item.active
|
27
|
+
%a{:href => "#"} Objects
|
26
28
|
|
27
29
|
.alert.alert-warning{:role => "alert"}
|
28
30
|
%h4.alert-heading
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.card
|
2
|
+
.card-header
|
3
|
+
= @instance.identifier
|
4
|
+
= "-"
|
5
|
+
= @instance.created_at.strftime("%c")
|
6
|
+
.card-body
|
7
|
+
|
8
|
+
- content_for :header_nav do
|
9
|
+
%ul.nav.navbar-nav.d-md-down-none
|
10
|
+
%li.nav-item
|
11
|
+
%a.nav-link.navbar-toggler.sidebar-toggler{:href => "#"} ☰
|
12
|
+
%li.nav-item.px-3
|
13
|
+
%a.nav-link{:href => group_instance_path(@instance)} List
|
14
|
+
|
15
|
+
%ul.navbar-nav.ml-md-auto
|
16
|
+
|
17
|
+
|
18
|
+
- content_for :breadcrum do
|
19
|
+
%ol.breadcrumb
|
20
|
+
%li.breadcrumb-item
|
21
|
+
%a{:href => analysis_groups_path} Analysis Groups
|
22
|
+
%li.breadcrumb-item
|
23
|
+
%a{:href => analysis_group_path(@instance.analysis_group.id)}= @instance.analysis_group.name
|
24
|
+
%li.breadcrumb-item
|
25
|
+
%a{:href => "#"}= @instance.identifier
|
26
|
+
|
27
|
+
%h2 Summary
|
28
|
+
|
29
|
+
- if @instance.status != 'finished'
|
30
|
+
.text-warning
|
31
|
+
The system didn't finished to collect and process all the information.
|
32
|
+
|
33
|
+
= render partial: 'better_rails_debugger/group_instances/memory_summary'
|
34
|
+
|
35
|
+
=# render partial: 'better_rails_debugger/group_instances/method_summary'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.card
|
2
|
+
.card-header
|
3
|
+
= @instance.identifier
|
4
|
+
= "-"
|
5
|
+
= @instance.created_at.strftime("%c")
|
6
|
+
.card-body
|
7
|
+
|
8
|
+
- content_for :header_nav do
|
9
|
+
%ul.nav.navbar-nav.d-md-down-none
|
10
|
+
%li.nav-item
|
11
|
+
%a.nav-link.navbar-toggler.sidebar-toggler{:href => "#"} ☰
|
12
|
+
%li.nav-item.px-3
|
13
|
+
%a.nav-link{:href => group_instance_path(@instance)} List
|
14
|
+
|
15
|
+
%ul.navbar-nav.ml-md-auto
|
16
|
+
|
17
|
+
|
18
|
+
- content_for :breadcrum do
|
19
|
+
%ol.breadcrumb
|
20
|
+
%li.breadcrumb-item
|
21
|
+
%a{:href => analysis_groups_path} Analysis Groups
|
22
|
+
%li.breadcrumb-item
|
23
|
+
%a{:href => analysis_group_path(@instance.analysis_group.id)}= @instance.analysis_group.name
|
24
|
+
%li.breadcrumb-item
|
25
|
+
%a{:href => "#"}= @instance.identifier
|
26
|
+
|
27
|
+
%table.table.border.border-secondary.border-top-0
|
28
|
+
%thead.bg-secondary.text-white
|
29
|
+
%tr.d-flex
|
30
|
+
%th.col-8= order_link "Location", 'location', @instance
|
31
|
+
%th.col-2= order_link "Method", 'method', @instance
|
32
|
+
%th.col-2 Times
|
33
|
+
%tbody
|
34
|
+
- @instance.count_methods.each_pair do |location, hash|
|
35
|
+
%tr.d-flex
|
36
|
+
%td.col-8= location
|
37
|
+
%td.col-2= hash[:item].method_id
|
38
|
+
%td.col-2= hash[:count]
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'objspace'
|
2
2
|
|
3
3
|
module BetterRailsDebugger
|
4
|
-
class
|
4
|
+
class Analyzer
|
5
5
|
include Singleton
|
6
6
|
|
7
7
|
|
@@ -13,6 +13,7 @@ module BetterRailsDebugger
|
|
13
13
|
yield
|
14
14
|
return
|
15
15
|
end
|
16
|
+
start_trace_point group
|
16
17
|
# If we reached the max time to execute the code, just execute the code and do not collect information
|
17
18
|
if times_to_run_exceeded?(group) or skip_instance?(group, identifier)
|
18
19
|
yield
|
@@ -20,7 +21,28 @@ module BetterRailsDebugger
|
|
20
21
|
::ObjectSpace.trace_object_allocations do
|
21
22
|
yield
|
22
23
|
end
|
23
|
-
|
24
|
+
end
|
25
|
+
end_trace_point
|
26
|
+
collect_information(identifier, group_id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def start_trace_point(group)
|
30
|
+
if group.generate_method_execution_history
|
31
|
+
@trace_point_history = []
|
32
|
+
tracer
|
33
|
+
tracer.enable
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def end_trace_point
|
38
|
+
tracer.disable
|
39
|
+
end
|
40
|
+
|
41
|
+
def tracer
|
42
|
+
return @tracer if @tracer
|
43
|
+
@tracer = TracePoint.new do |tp|
|
44
|
+
# Record everything but us
|
45
|
+
@trace_point_history << {source_file: tp.path, source_line: tp.lineno, method_id: tp.method_id} if tp.path !~ /better_rails_debugger/
|
24
46
|
end
|
25
47
|
end
|
26
48
|
|
@@ -51,9 +73,10 @@ module BetterRailsDebugger
|
|
51
73
|
Mongoid.logger.level = Logger::FATAL
|
52
74
|
end
|
53
75
|
|
54
|
-
instance = ::BetterRailsDebugger::GroupInstance.create identifier: identifier, analysis_group_id: group_id, caller_file: caller[3][/[^:]+/]
|
76
|
+
instance = ::BetterRailsDebugger::GroupInstance.create identifier: identifier, analysis_group_id: group_id, caller_file: caller[3][/[^:]+/], status: 'pending'
|
55
77
|
|
56
78
|
collect_memory_information(instance)
|
79
|
+
collect_trace_point_history(instance)
|
57
80
|
|
58
81
|
# Now, it's time to analyze all collected data and generate a report
|
59
82
|
::BetterRailsDebugger::AnalysisRecorderJob.perform_later({ instance_id: instance.id.to_s })
|
@@ -91,6 +114,15 @@ module BetterRailsDebugger
|
|
91
114
|
::BetterRailsDebugger::ObjectInformation.collection.insert_many(objects)
|
92
115
|
end
|
93
116
|
|
117
|
+
def collect_trace_point_history(instance)
|
118
|
+
return if !@trace_point_history.kind_of? Array
|
119
|
+
::BetterRailsDebugger::TracePointItem.collection.insert_many(@trace_point_history.map do |item|
|
120
|
+
item[:group_instance_id] = instance.id
|
121
|
+
item
|
122
|
+
end)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
94
126
|
def all_valid_classes
|
95
127
|
return @all_valid_classes if @all_valid_classes
|
96
128
|
if !@all_classes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_rails_debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andres Jose Borek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -186,13 +186,18 @@ files:
|
|
186
186
|
- app/models/better_rails_debugger/application_record.rb
|
187
187
|
- app/models/better_rails_debugger/group_instance.rb
|
188
188
|
- app/models/better_rails_debugger/object_information.rb
|
189
|
+
- app/models/better_rails_debugger/trace_point_item.rb
|
189
190
|
- app/views/better_rails_debugger/analysis_groups/_form.html.haml
|
190
191
|
- app/views/better_rails_debugger/analysis_groups/edit.html.haml
|
191
192
|
- app/views/better_rails_debugger/analysis_groups/index.html.haml
|
192
193
|
- app/views/better_rails_debugger/analysis_groups/new.html.haml
|
193
194
|
- app/views/better_rails_debugger/analysis_groups/show.html.haml
|
195
|
+
- app/views/better_rails_debugger/group_instances/_memory_summary.html.haml
|
196
|
+
- app/views/better_rails_debugger/group_instances/_method_summary.html.haml
|
194
197
|
- app/views/better_rails_debugger/group_instances/_stats_summary.html.haml
|
195
198
|
- app/views/better_rails_debugger/group_instances/objects.html.haml
|
199
|
+
- app/views/better_rails_debugger/group_instances/show.html.haml
|
200
|
+
- app/views/better_rails_debugger/group_instances/tracer.html.haml
|
196
201
|
- app/views/better_rails_debugger/memory/index.html.haml
|
197
202
|
- app/views/better_rails_debugger/memory/show.html.haml
|
198
203
|
- app/views/better_rails_debugger/shared/_header.html.haml
|
@@ -202,9 +207,9 @@ files:
|
|
202
207
|
- config/mongoid.yml
|
203
208
|
- config/routes.rb
|
204
209
|
- lib/better_rails_debugger.rb
|
210
|
+
- lib/better_rails_debugger/analyzer.rb
|
205
211
|
- lib/better_rails_debugger/config.rb
|
206
212
|
- lib/better_rails_debugger/engine.rb
|
207
|
-
- lib/better_rails_debugger/memory_analyzer.rb
|
208
213
|
- lib/better_rails_debugger/version.rb
|
209
214
|
- lib/tasks/better_rails_debugger_tasks.rake
|
210
215
|
homepage: ''
|