tuttle 0.0.4 → 0.0.5
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/CHANGELOG.md +9 -0
- data/app/controllers/tuttle/active_model_serializers_controller.rb +26 -0
- data/app/controllers/tuttle/active_support_controller.rb +26 -0
- data/app/controllers/tuttle/cancancan_controller.rb +1 -0
- data/app/controllers/tuttle/gems_controller.rb +4 -0
- data/app/controllers/tuttle/home_controller.rb +1 -3
- data/app/controllers/tuttle/performance_tuning_controller.rb +14 -0
- data/app/controllers/tuttle/rails_controller.rb +20 -18
- data/app/controllers/tuttle/request_controller.rb +16 -0
- data/app/controllers/tuttle/ruby_controller.rb +2 -0
- data/app/helpers/tuttle/application_helper.rb +8 -0
- data/app/views/layouts/tuttle/application.html.erb +22 -7
- data/app/views/tuttle/active_model_serializers/index.html.erb +86 -0
- data/app/views/tuttle/active_model_serializers/index9.html.erb +68 -0
- data/app/views/tuttle/active_support/dependencies.html.erb +72 -0
- data/app/views/tuttle/active_support/index.html.erb +69 -0
- data/app/views/tuttle/{rails → active_support}/inflectors.html.erb +0 -0
- data/app/views/tuttle/active_support/time_zones.html.erb +24 -0
- data/app/views/tuttle/cancancan/rule_tester.html.erb +1 -20
- data/app/views/tuttle/devise/index.html.erb +62 -9
- data/app/views/tuttle/gems/get_process_mem.html.erb +92 -0
- data/app/views/tuttle/gems/other.html.erb +102 -0
- data/app/views/tuttle/home/index.html.erb +1 -1
- data/app/views/tuttle/performance_tuning/index.html.erb +79 -0
- data/app/views/tuttle/rails/assets.html.erb +38 -43
- data/app/views/tuttle/rails/database.html.erb +2 -2
- data/app/views/tuttle/rails/engines.html.erb +40 -0
- data/app/views/tuttle/rails/generators.html.erb +74 -0
- data/app/views/tuttle/rails/index.html.erb +62 -86
- data/app/views/tuttle/rails/models.html.erb +16 -1
- data/app/views/tuttle/rails/schema_cache.html.erb +3 -1
- data/app/views/tuttle/request/index.html.erb +37 -0
- data/app/views/tuttle/ruby/index.html.erb +65 -0
- data/config/routes.rb +19 -3
- data/lib/tuttle.rb +6 -1
- data/lib/tuttle/engine.rb +23 -61
- data/lib/tuttle/instrumenter.rb +38 -0
- data/lib/tuttle/middleware/request_profiler.rb +80 -0
- data/lib/tuttle/ruby_prof/fast_call_stack_printer.rb +164 -0
- data/lib/tuttle/version.rb +1 -1
- metadata +21 -21
- data/app/assets/images/tuttle/favicon.ico +0 -0
- data/app/assets/javascripts/tuttle/application.js +0 -12
- data/app/assets/stylesheets/tuttle/application.css +0 -71
@@ -0,0 +1,72 @@
|
|
1
|
+
<h1>Active Support Dependencies</h1>
|
2
|
+
|
3
|
+
<!-- TODO: add option to toggle log/activity and control logger at runtime -->
|
4
|
+
|
5
|
+
<table class="table table-condensed">
|
6
|
+
<tr>
|
7
|
+
<th>Setting</th>
|
8
|
+
<th>Value</th>
|
9
|
+
<th>Description</th>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td>warnings_on_first_load</td>
|
13
|
+
<td><%= truth_label(ActiveSupport::Dependencies.warnings_on_first_load) %></td>
|
14
|
+
<td>Should we turn on Ruby warnings on the first load of dependent files?</td>
|
15
|
+
</tr>
|
16
|
+
<tr>
|
17
|
+
<td>mechanism</td>
|
18
|
+
<td><code><%= ActiveSupport::Dependencies.mechanism %></code></td>
|
19
|
+
<td>Should we load files or require them?</td>
|
20
|
+
</tr>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<h3>Autoload Paths (<%= ActiveSupport::Dependencies.autoload_paths.size %> directories)</h3>
|
24
|
+
<p>
|
25
|
+
The set of directories from which we may automatically load files. Files
|
26
|
+
under these directories will be reloaded on each request in development mode,
|
27
|
+
unless the directory also appears in autoload_once_paths.
|
28
|
+
</p>
|
29
|
+
<ul>
|
30
|
+
<%- ActiveSupport::Dependencies.autoload_paths.each do |path_name| %>
|
31
|
+
<li><%= path_name %></li>
|
32
|
+
<%- end %>
|
33
|
+
</ul>
|
34
|
+
|
35
|
+
<h3>Autoload Once Paths (<%= ActiveSupport::Dependencies.autoload_once_paths.size %> directories)</h3>
|
36
|
+
<p>
|
37
|
+
The set of directories from which automatically loaded constants are loaded
|
38
|
+
only once. All directories in this set must also be present in +autoload_paths+.
|
39
|
+
</p>
|
40
|
+
<ul>
|
41
|
+
<%- ActiveSupport::Dependencies.autoload_once_paths.each do |path_name| %>
|
42
|
+
<li><%= path_name %></li>
|
43
|
+
<%- end %>
|
44
|
+
</ul>
|
45
|
+
|
46
|
+
<h3>Explicitly Unloadable Constants (<%= ActiveSupport::Dependencies.explicitly_unloadable_constants.size %> constants)</h3>
|
47
|
+
<p>
|
48
|
+
An array of constant names that need to be unloaded on every request. Used
|
49
|
+
to allow arbitrary constants to be marked for unloading.
|
50
|
+
</p>
|
51
|
+
<ul>
|
52
|
+
<%- ActiveSupport::Dependencies.explicitly_unloadable_constants.each do |const| %>
|
53
|
+
<li><%= const %></li>
|
54
|
+
<%- end %>
|
55
|
+
</ul>
|
56
|
+
|
57
|
+
<h3>Autoloaded Constants (<%= ActiveSupport::Dependencies.autoloaded_constants.size %> constants)</h3>
|
58
|
+
<p>
|
59
|
+
An array of qualified constant names that have been loaded.
|
60
|
+
</p>
|
61
|
+
<ul>
|
62
|
+
<%- ActiveSupport::Dependencies.autoloaded_constants.each do |const| %>
|
63
|
+
<li><%= const %></li>
|
64
|
+
<%- end %>
|
65
|
+
</ul>
|
66
|
+
|
67
|
+
<h3>Loaded files (<%= ActiveSupport::Dependencies.history.size %> files)</h3>
|
68
|
+
<ul>
|
69
|
+
<% ActiveSupport::Dependencies.history.sort.each do |loaded_file| %>
|
70
|
+
<li><%= loaded_file %><%= ActiveSupport::Dependencies.loaded.include?(loaded_file) ? nil : ' - NOT LOADED' %></li>
|
71
|
+
<% end %>
|
72
|
+
</ul>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<h1>Active Support Overview</h1>
|
2
|
+
|
3
|
+
<dl class="dl-horizontal">
|
4
|
+
<dt>Active Support Version</dt><dd><%= ActiveSupport::VERSION::STRING %></dd>
|
5
|
+
</dl>
|
6
|
+
|
7
|
+
<h3>Config Settings</h3>
|
8
|
+
<table class="table table-condensed">
|
9
|
+
<tr>
|
10
|
+
<th>Setting</th>
|
11
|
+
<th>Value</th>
|
12
|
+
<th>Description</th>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<td>config.active_support</td>
|
16
|
+
<td><code><%= Rails.configuration.active_support %></code></td>
|
17
|
+
<td>All settings for config.active_support</td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td>config.active_support.bare</td>
|
21
|
+
<td><%= truth_label(Rails.configuration.active_support.bare) %></td>
|
22
|
+
<td>enables or disables the loading of active_support/all when booting Rails. Defaults to nil, which means active_support/all is loaded.</td>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<td>config.active_support.test_order</td>
|
26
|
+
<td><code><%= Rails.configuration.active_support.test_order %></code></td>
|
27
|
+
<td>sets the order that test cases are executed. Possible values are :sorted and :random. Currently defaults to :sorted. In Rails 5.0, the default will be changed to :random instead.</td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td>config.active_support.escape_html_entities_in_json</td>
|
31
|
+
<td><code><%= Rails.configuration.active_support.escape_html_entities_in_json %></code></td>
|
32
|
+
<td>enables or disables the escaping of HTML entities in JSON serialization. Defaults to false.</td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<td>config.active_support.use_standard_json_time_format</td>
|
36
|
+
<td><code><%= Rails.configuration.active_support.use_standard_json_time_format %></code></td>
|
37
|
+
<td>enables or disables serializing dates to ISO 8601 format. Defaults to true.</td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td>config.active_support.time_precision</td>
|
41
|
+
<td><code><%= Rails.configuration.active_support.time_precision %></code></td>
|
42
|
+
<td>sets the precision of JSON encoded time values. Defaults to 3.</td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td>ActiveSupport::Logger.silencer</td>
|
46
|
+
<td><%= truth_label(ActiveSupport::Logger.silencer) %></td>
|
47
|
+
<td>set to false to disable the ability to silence logging in a block. The default is true.</td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td>ActiveSupport::Cache::Store.logger</td>
|
51
|
+
<td><code><%= ActiveSupport::Cache::Store.logger %></code></td>
|
52
|
+
<td>specifies the logger to use within cache store operations</td>
|
53
|
+
</tr>
|
54
|
+
<tr>
|
55
|
+
<td>ActiveSupport::Deprecation.silenced</td>
|
56
|
+
<td><%= truth_label(ActiveSupport::Deprecation.silenced) %></td>
|
57
|
+
<td>sets whether or not to display deprecation warnings</td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td>config.active_support.deprecation</td>
|
61
|
+
<td><code><%= Rails.configuration.active_support.deprecation %></code></td>
|
62
|
+
<td>specifies which deprecation method to use. the default values are <code><%= ActiveSupport::Deprecation::DEFAULT_BEHAVIORS.keys %></code></td>
|
63
|
+
</tr>
|
64
|
+
<tr>
|
65
|
+
<td>current deprecation behavior</td>
|
66
|
+
<td><code><%= ActiveSupport::Deprecation::DEFAULT_BEHAVIORS.key(ActiveSupport::Deprecation.behavior.first) || 'custom' %></code></td>
|
67
|
+
<td>The current runtime value of the depreaction behavior</td>
|
68
|
+
</tr>
|
69
|
+
</table>
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>ActiveSupport Time Zones</h1>
|
2
|
+
|
3
|
+
<!-- TODO: add information about how time zones are configured and possible options -->
|
4
|
+
|
5
|
+
<h2>All TimeZones</h2>
|
6
|
+
|
7
|
+
<table class="table table-striped table-condensed">
|
8
|
+
<tr>
|
9
|
+
<th>Name</th>
|
10
|
+
<th>UTC Offset</th>
|
11
|
+
<th>to_s</th>
|
12
|
+
<th>Now</th>
|
13
|
+
<th>TZInfo</th>
|
14
|
+
</tr>
|
15
|
+
<% ActiveSupport::TimeZone.all.each do |tz| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= tz.name %></td>
|
18
|
+
<td><%= tz.utc_offset %></td>
|
19
|
+
<td><%= tz.to_s %></td>
|
20
|
+
<td><%= tz.now %></td>
|
21
|
+
<td><%= tz.tzinfo %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
</ul>
|
8
8
|
<br/>
|
9
9
|
|
10
|
-
<form class="form-horizontal" role="form"
|
10
|
+
<form class="form-horizontal" role="form" method="get">
|
11
11
|
<div class="form-group">
|
12
12
|
<label for="action_name" class="col-sm-2 control-label">Action</label>
|
13
13
|
<div class="col-sm-10">
|
@@ -47,22 +47,3 @@
|
|
47
47
|
|
48
48
|
<h3>All Rules</h3>
|
49
49
|
<%= render :partial => 'rule_table', :locals => {:rules => @ability.instance_variable_get('@rules') } =%>
|
50
|
-
|
51
|
-
<%- action_list = @ability.instance_variable_get('@rules').collect(&:actions).flatten.uniq -%>
|
52
|
-
|
53
|
-
<%- content_for(:javascripts) do -%>
|
54
|
-
<script>
|
55
|
-
var action_name_list = <%= action_list.as_json.to_s.html_safe =%>;
|
56
|
-
var action_names = new Bloodhound({
|
57
|
-
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
|
58
|
-
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
59
|
-
local: $.map(action_name_list, function(name) { return { value: name }; })
|
60
|
-
});
|
61
|
-
|
62
|
-
action_names.initialize();
|
63
|
-
|
64
|
-
$('#action_name.typeahead').typeahead({ hint: true, highlight: true, minLength: 1},
|
65
|
-
{ name: 'action_names', displayKey: 'value', source: action_names.ttAdapter()
|
66
|
-
});
|
67
|
-
</script>
|
68
|
-
<%- end -%>
|
@@ -1,12 +1,68 @@
|
|
1
1
|
<h1>Devise Configuration</h1>
|
2
2
|
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
</
|
3
|
+
<nav>
|
4
|
+
<ul class="nav nav-pills">
|
5
|
+
<li role="presentation" class="active"><a href="#mappings" role="tab" data-toggle="pill">Mappings</a></li>
|
6
|
+
<li role="presentation"><a href="#overview" role="tab" data-toggle="pill">Overview</a></li>
|
7
|
+
<li role="presentation"><a href="#config" role="tab" data-toggle="pill">Config</a></li>
|
8
|
+
</ul>
|
9
|
+
</nav>
|
7
10
|
|
8
11
|
<div class="tab-content">
|
9
|
-
<div class="tab-pane active" id="
|
12
|
+
<div role="tabpanel" class="tab-pane active" id="mappings">
|
13
|
+
<% Devise.mappings.each do |key, mapping| %>
|
14
|
+
<div class="panel panel-default">
|
15
|
+
<div class="panel-heading">
|
16
|
+
<h3 class="panel-title">:<%= key %> => <%= mapping.class_name %></h3>
|
17
|
+
</div>
|
18
|
+
<div class="panel-body">
|
19
|
+
<h3>Attributes</h3>
|
20
|
+
<table class="table table-condensed">
|
21
|
+
<tr>
|
22
|
+
<th>Attribute</th>
|
23
|
+
<th>Value</th>
|
24
|
+
</tr>
|
25
|
+
<% [:singular, :scoped_path, :path, :controllers, :path_names,
|
26
|
+
:class_name, :sign_out_via, :format, :used_routes, :used_helpers,
|
27
|
+
:failure_app, :router_name, :strategies, :authenticatable?].each do |attr| %>
|
28
|
+
<tr>
|
29
|
+
<td><%= attr %></td>
|
30
|
+
<td><%= mapping.send(attr) %></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
<h3>Enabled Modules</h3>
|
35
|
+
<table class="table table-condensed">
|
36
|
+
<tr>
|
37
|
+
<th>Module Name</th>
|
38
|
+
<th>Config Options</th>
|
39
|
+
</tr>
|
40
|
+
<% mapped_class = mapping.to
|
41
|
+
mapped_class.devise_modules.each do |devise_module| %>
|
42
|
+
<tr>
|
43
|
+
<td>:<%= devise_module %></td>
|
44
|
+
<td>
|
45
|
+
<%
|
46
|
+
mod = Devise::Models.const_get(devise_module.to_s.classify)
|
47
|
+
if mod.const_defined?(:ClassMethods)
|
48
|
+
class_mod = mod.const_get(:ClassMethods)
|
49
|
+
if class_mod.respond_to?(:available_configs)
|
50
|
+
class_mod.available_configs.each do |config| %>
|
51
|
+
<%= config %>:
|
52
|
+
<code><%= mapped_class.send(config) %></code><br/>
|
53
|
+
<% end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
%>
|
57
|
+
</td>
|
58
|
+
</tr>
|
59
|
+
<% end %>
|
60
|
+
</table>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
<div role="tabpanel" class="tab-pane" id="overview">
|
10
66
|
<dl class="dl-horizontal">
|
11
67
|
<dt>Devise Version</dt><dd><%= Devise::VERSION %></dd>
|
12
68
|
</dl>
|
@@ -23,10 +79,8 @@
|
|
23
79
|
|
24
80
|
</pre>
|
25
81
|
</div>
|
26
|
-
|
27
|
-
<div class="tab-pane" id="config">
|
82
|
+
<div role="tabpanel" class="tab-pane" id="config">
|
28
83
|
<pre>
|
29
|
-
|
30
84
|
rememberable_options = <%= Devise.rememberable_options %>
|
31
85
|
stretches = <%= Devise.stretches %>
|
32
86
|
http_authentication_key = <%= Devise.http_authentication_key %>
|
@@ -67,7 +121,6 @@ parent_mailer = <%= Devise.parent_mailer %>
|
|
67
121
|
router_name = <%= Devise.router_name %>
|
68
122
|
omniauth_path_prefix = <%= Devise.omniauth_path_prefix %>
|
69
123
|
clean_up_csrf_token_on_authentication = <%= Devise.clean_up_csrf_token_on_authentication %>
|
70
|
-
mappings = <%= Devise.mappings %>
|
71
124
|
omniauth_configs = <%= Devise.omniauth_configs %>
|
72
125
|
helpers = <%= Devise.helpers %>
|
73
126
|
warden_config = <%= Devise.warden_config %>
|
@@ -0,0 +1,92 @@
|
|
1
|
+
<h2>Process and Memory</h2>
|
2
|
+
GetProcessMem Version: <%= GetProcessMem::VERSION %>
|
3
|
+
|
4
|
+
<h3>Ruby Process Information</h3>
|
5
|
+
<table class="table table-condensed not-wide">
|
6
|
+
<tr>
|
7
|
+
<th>PID</th>
|
8
|
+
<td><%= $PID %></td>
|
9
|
+
</tr>
|
10
|
+
<tr>
|
11
|
+
<th>Parent PPID</th>
|
12
|
+
<td><%= Process.ppid %></td>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<th>Process EGID</th>
|
16
|
+
<td><%= Process.egid %></td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<th>Process EUID</th>
|
20
|
+
<td><%= Process.euid %></td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<th>Process pgrp</th>
|
24
|
+
<td><%= Process.getpgrp %></td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<th>Process rlimit(Process::RLIMIT_CORE)</th>
|
28
|
+
<td><%= Process.getrlimit(Process::RLIMIT_CORE) %></td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<th>Process rlimit(Process::RLIMIT_MEMLOCK)</th>
|
32
|
+
<td><%= Process.getrlimit(Process::RLIMIT_MEMLOCK) %></td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<th>Process getsid</th>
|
36
|
+
<td><%= Process.getsid %></td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<th>Process gid</th>
|
40
|
+
<td><%= Process.gid %></td>
|
41
|
+
</tr>
|
42
|
+
<tr>
|
43
|
+
<th>Process groups</th>
|
44
|
+
<td><%= Process.groups %></td>
|
45
|
+
</tr>
|
46
|
+
<tr>
|
47
|
+
<th>Process maxgroups</th>
|
48
|
+
<td><%= Process.maxgroups %></td>
|
49
|
+
</tr>
|
50
|
+
</table>
|
51
|
+
|
52
|
+
|
53
|
+
<% if defined?(GetProcessMem) %>
|
54
|
+
<% memory_self = GetProcessMem.new($PID) %>
|
55
|
+
<% memory_parent = GetProcessMem.new(Process.ppid) %>
|
56
|
+
<h3>GetProcessMem</h3>
|
57
|
+
<table class="table table-condensed not-wide">
|
58
|
+
<tr>
|
59
|
+
<th>Linux?</th>
|
60
|
+
<td><%= truth_label(memory_self.linux?) %></td>
|
61
|
+
</tr>
|
62
|
+
<tr>
|
63
|
+
<th>PID bytes</th>
|
64
|
+
<td><%= memory_self.bytes %></td>
|
65
|
+
</tr>
|
66
|
+
<tr>
|
67
|
+
<th>PID ps_memory</th>
|
68
|
+
<td><%= memory_self.send(:ps_memory) %></td>
|
69
|
+
</tr>
|
70
|
+
<% if memory_parent.respond_to?(:linux_status_memory) %>
|
71
|
+
<tr>
|
72
|
+
<th>PID status_memory</th>
|
73
|
+
<td><%= memory_self.linux_status_memory || '--Unknown--' %></td>
|
74
|
+
</tr>
|
75
|
+
<% end %>
|
76
|
+
<tr>
|
77
|
+
<th>PPID bytes</th>
|
78
|
+
<td><%= memory_parent.bytes %></td>
|
79
|
+
</tr>
|
80
|
+
<tr>
|
81
|
+
<th>PPID ps_memory</th>
|
82
|
+
<td><%= memory_parent.send(:ps_memory) %></td>
|
83
|
+
</tr>
|
84
|
+
<% if memory_parent.respond_to?(:linux_status_memory) %>
|
85
|
+
<tr>
|
86
|
+
<th>PPID status_memory</th>
|
87
|
+
<td><%= memory_parent.linux_status_memory || '--Unknown--' %></td>
|
88
|
+
</tr>
|
89
|
+
<% end %>
|
90
|
+
</table>
|
91
|
+
|
92
|
+
<% end %>
|
@@ -14,3 +14,105 @@
|
|
14
14
|
<div class="panel-footer">
|
15
15
|
</div>
|
16
16
|
</div>
|
17
|
+
|
18
|
+
<div class="panel panel-default">
|
19
|
+
<div class="panel-heading">
|
20
|
+
<h3 class="panel-title">Work In Progress</h3>
|
21
|
+
</div>
|
22
|
+
<div class="panel-body">
|
23
|
+
<p>Much of Tuttle is a work in progress. But these bits are still under development...</p>
|
24
|
+
<ul>
|
25
|
+
<li><%= link_to 'Request Inspector', '/tuttle/request' %></li>
|
26
|
+
<% if defined?(ActiveModel::Serializers) %>
|
27
|
+
<li><%= link_to 'ActiveModel Serializers', '/tuttle/active_model_serializers' %> - (0.9 and 0.10 support)</li>
|
28
|
+
<% end %>
|
29
|
+
<% if defined?(Rack::MiniProfiler) %>
|
30
|
+
<li><%= link_to 'Rack::MiniProfiler', '/tuttle/performance_tuning' %></li>
|
31
|
+
<% end %>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div class="panel-footer">
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="panel panel-default">
|
39
|
+
<div class="panel-heading">
|
40
|
+
<h3 class="panel-title">Experimental Request Profiler</h3>
|
41
|
+
</div>
|
42
|
+
<div class="panel-body">
|
43
|
+
<p>
|
44
|
+
Tuttle includes an optional middleware (Tuttle::Middleware::RequestProfiler)
|
45
|
+
to assist with memory and CPU profiling using the
|
46
|
+
<code>memory_profiler</code> and <code>ruby-prof</code> gems.
|
47
|
+
</p>
|
48
|
+
<p>
|
49
|
+
This middleware provides the ability to profile individual requests on demand
|
50
|
+
and to vary the profiling options.
|
51
|
+
</p>
|
52
|
+
<h4>Middleware Installation</h4>
|
53
|
+
<p>
|
54
|
+
Middleware loaded? <%= truth_label(defined?(Tuttle::Middleware::RequestProfiler)) %>
|
55
|
+
</p>
|
56
|
+
<% if defined?(Tuttle::Middleware::RequestProfiler) && middleware_position = Rails.application.config.middleware.middlewares.index(Tuttle::Middleware::RequestProfiler) %>
|
57
|
+
<p>
|
58
|
+
Middleware stack position: <%= middleware_position + 1 %>
|
59
|
+
</p>
|
60
|
+
<br/>
|
61
|
+
|
62
|
+
<h4>Memory Profiling <%= truth_label(defined?(MemoryProfiler), 'available', 'not available') %></h4>
|
63
|
+
<p>Profile memory allocation using <code>memory_profiler</code> with <code>tuttle-profiler=memory_profiler</code> query param.</p>
|
64
|
+
<p>
|
65
|
+
Additional parameters can include:
|
66
|
+
<ul>
|
67
|
+
<li><code>memory_profiler_allow_files</code> - Regexp pattern for files to be included</li>
|
68
|
+
<li><code>memory_profiler_ignore_files</code> - Regexp pattern for files to be ignored</li>
|
69
|
+
<li><code>memory_profiler_top</code> - Number of lines to include in report (defaults to 50)</li>
|
70
|
+
</ul>
|
71
|
+
</p>
|
72
|
+
<p>Example:
|
73
|
+
<% example_url = main_app_root_url + '?tuttle-profiler=memory_profiler' %>
|
74
|
+
<%= link_to example_url, example_url %></p>
|
75
|
+
<br/>
|
76
|
+
|
77
|
+
<h4>CPU Profiling <%= truth_label(defined?(RubyProf), 'available', 'not available') %></h4>
|
78
|
+
<p>Profile CPU usage using <code>ruby-prof</code> with <code>tuttle-profiler=ruby-prof</code> query param.</p>
|
79
|
+
<p>
|
80
|
+
Specify the profile type with a <code>ruby-prof_printer</code> parameter:
|
81
|
+
<ul>
|
82
|
+
<li><code>stack</code> - (Default) Visualization of the call hierarchy with time spent in each method</li>
|
83
|
+
<li><code>fast_stack</code> - Fast version of stack (without colors or links)</li>
|
84
|
+
<li><code>flat</code> - Overall time spent in each method</li>
|
85
|
+
<li><code>graph</code> - Time spent in each method and callers/callees</li>
|
86
|
+
</ul>
|
87
|
+
<p>Example:
|
88
|
+
<% example_url = main_app_root_url + '?tuttle-profiler=ruby-prof&ruby-prof_printer=fast_stack' %>
|
89
|
+
<%= link_to example_url, example_url %></p>
|
90
|
+
</p>
|
91
|
+
|
92
|
+
<% else %>
|
93
|
+
<p>
|
94
|
+
You can include this middleware by configuring it in an initializer.
|
95
|
+
It can be put at the beginning of the stack to help profile the other middleware.
|
96
|
+
Or it can be put at the end of the stack to focus on memory from the application.
|
97
|
+
</p>
|
98
|
+
<pre>
|
99
|
+
require 'tuttle/middleware/request_profiler'
|
100
|
+
# Add memory profiler middleware at beginning of the stack
|
101
|
+
# Rails.application.config.middleware.insert(0, Tuttle::Middleware::RequestProfiler)
|
102
|
+
|
103
|
+
# Add memory profiler middleware at the end of the stack
|
104
|
+
Rails.application.config.middleware.use Tuttle::Middleware::RequestProfiler
|
105
|
+
</pre>
|
106
|
+
<% end %>
|
107
|
+
|
108
|
+
<br/>
|
109
|
+
<p>
|
110
|
+
<em>Note: Ruby-prof also provides a middleware that saves profile results to a directory
|
111
|
+
on the server for every request. And RackMiniProfiler includes this same
|
112
|
+
memory_profiler capability but requires RackMiniProfiler to be enabled,
|
113
|
+
which has an impact on profiling.</em>
|
114
|
+
</p>
|
115
|
+
</div>
|
116
|
+
<div class="panel-footer">
|
117
|
+
</div>
|
118
|
+
</div>
|