rack-allocation_stats 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +7 -0
- data/LICENSE +195 -0
- data/README.markdown +114 -0
- data/TODO.markdown +31 -0
- data/lib/rack/allocation_stats/help.txt +19 -0
- data/lib/rack/allocation_stats/interactive/allocations.js.erb +24 -0
- data/lib/rack/allocation_stats/interactive/index.html.erb +109 -0
- data/lib/rack/allocation_stats/interactive/interactive.js +274 -0
- data/lib/rack/allocation_stats/interactive/jquery-2.0.3.min.js +6 -0
- data/lib/rack/allocation_stats/interactive/jquery-ui-1.10.3.custom.min.css +6 -0
- data/lib/rack/allocation_stats/interactive/jquery-ui-1.10.3.custom.min.js +6 -0
- data/lib/rack/allocation_stats/interactive/sizzle.min.js +5 -0
- data/lib/rack/allocation_stats/interactive/style.css +104 -0
- data/lib/rack/allocation_stats/interactive/style.scss +147 -0
- data/lib/rack/allocation_stats/interactive/underscore-min.js +6 -0
- data/spec/hello_world.ru +8 -0
- data/spec/javascripts/css/docco.css +186 -0
- data/spec/javascripts/css/jasmine_docco-1.3.1.css +363 -0
- data/spec/javascripts/interactive_spec.html +220 -0
- data/spec/javascripts/interactive_spec.html.mustache +78 -0
- data/spec/javascripts/interactive_spec.js +110 -0
- data/spec/javascripts/js/jasmine-html.js +681 -0
- data/spec/javascripts/js/jasmine.css +82 -0
- data/spec/javascripts/js/jasmine.js +2600 -0
- data/spec/sinatra.ru +8 -0
- data/spec/sinatra_templates.ru +8 -0
- data/spec/sinatra_templates_app.rb +1 -1
- data/spec/yajl.ru +8 -0
- data/spec/yaml.ru +8 -0
- metadata +58 -97
- data/demo_rack_apps/Rails_3.2.15/app/controllers/application_controller.rb +0 -3
- data/demo_rack_apps/Rails_3.2.15/app/controllers/projects_controller.rb +0 -83
- data/demo_rack_apps/Rails_3.2.15/app/controllers/tasks_controller.rb +0 -83
- data/demo_rack_apps/Rails_3.2.15/app/helpers/application_helper.rb +0 -2
- data/demo_rack_apps/Rails_3.2.15/app/helpers/projects_helper.rb +0 -2
- data/demo_rack_apps/Rails_3.2.15/app/helpers/tasks_helper.rb +0 -2
- data/demo_rack_apps/Rails_3.2.15/app/models/project.rb +0 -4
- data/demo_rack_apps/Rails_3.2.15/app/models/task.rb +0 -4
- data/demo_rack_apps/Rails_3.2.15/config/application.rb +0 -63
- data/demo_rack_apps/Rails_3.2.15/config/boot.rb +0 -6
- data/demo_rack_apps/Rails_3.2.15/config/environment.rb +0 -5
- data/demo_rack_apps/Rails_3.2.15/config/environments/development.rb +0 -37
- data/demo_rack_apps/Rails_3.2.15/config/environments/production.rb +0 -67
- data/demo_rack_apps/Rails_3.2.15/config/environments/test.rb +0 -37
- data/demo_rack_apps/Rails_3.2.15/config/initializers/backtrace_silencers.rb +0 -7
- data/demo_rack_apps/Rails_3.2.15/config/initializers/inflections.rb +0 -15
- data/demo_rack_apps/Rails_3.2.15/config/initializers/mime_types.rb +0 -5
- data/demo_rack_apps/Rails_3.2.15/config/initializers/secret_token.rb +0 -7
- data/demo_rack_apps/Rails_3.2.15/config/initializers/session_store.rb +0 -8
- data/demo_rack_apps/Rails_3.2.15/config/initializers/wrap_parameters.rb +0 -14
- data/demo_rack_apps/Rails_3.2.15/config/routes.rb +0 -64
- data/demo_rack_apps/Rails_3.2.15/db/migrate/20131104031828_create_projects.rb +0 -11
- data/demo_rack_apps/Rails_3.2.15/db/migrate/20131104031829_create_tasks.rb +0 -11
- data/demo_rack_apps/Rails_3.2.15/db/schema.rb +0 -32
- data/demo_rack_apps/Rails_3.2.15/db/seeds.rb +0 -15
- data/demo_rack_apps/Rails_3.2.15/test/functional/projects_controller_test.rb +0 -49
- data/demo_rack_apps/Rails_3.2.15/test/functional/tasks_controller_test.rb +0 -49
- data/demo_rack_apps/Rails_3.2.15/test/performance/browsing_test.rb +0 -12
- data/demo_rack_apps/Rails_3.2.15/test/test_helper.rb +0 -13
- data/demo_rack_apps/Rails_3.2.15/test/unit/helpers/projects_helper_test.rb +0 -4
- data/demo_rack_apps/Rails_3.2.15/test/unit/helpers/tasks_helper_test.rb +0 -4
- data/demo_rack_apps/Rails_3.2.15/test/unit/project_test.rb +0 -7
- data/demo_rack_apps/Rails_3.2.15/test/unit/task_test.rb +0 -7
- data/demo_rack_apps/Rails_4.0.1/app/controllers/application_controller.rb +0 -5
- data/demo_rack_apps/Rails_4.0.1/app/controllers/projects_controller.rb +0 -74
- data/demo_rack_apps/Rails_4.0.1/app/controllers/tasks_controller.rb +0 -74
- data/demo_rack_apps/Rails_4.0.1/app/helpers/application_helper.rb +0 -2
- data/demo_rack_apps/Rails_4.0.1/app/helpers/projects_helper.rb +0 -2
- data/demo_rack_apps/Rails_4.0.1/app/helpers/tasks_helper.rb +0 -2
- data/demo_rack_apps/Rails_4.0.1/app/models/project.rb +0 -3
- data/demo_rack_apps/Rails_4.0.1/app/models/task.rb +0 -3
- data/demo_rack_apps/Rails_4.0.1/config/application.rb +0 -24
- data/demo_rack_apps/Rails_4.0.1/config/boot.rb +0 -4
- data/demo_rack_apps/Rails_4.0.1/config/environment.rb +0 -5
- data/demo_rack_apps/Rails_4.0.1/config/environments/development.rb +0 -29
- data/demo_rack_apps/Rails_4.0.1/config/environments/production.rb +0 -80
- data/demo_rack_apps/Rails_4.0.1/config/environments/test.rb +0 -36
- data/demo_rack_apps/Rails_4.0.1/config/initializers/backtrace_silencers.rb +0 -7
- data/demo_rack_apps/Rails_4.0.1/config/initializers/filter_parameter_logging.rb +0 -4
- data/demo_rack_apps/Rails_4.0.1/config/initializers/inflections.rb +0 -16
- data/demo_rack_apps/Rails_4.0.1/config/initializers/mime_types.rb +0 -5
- data/demo_rack_apps/Rails_4.0.1/config/initializers/secret_token.rb +0 -12
- data/demo_rack_apps/Rails_4.0.1/config/initializers/session_store.rb +0 -3
- data/demo_rack_apps/Rails_4.0.1/config/initializers/wrap_parameters.rb +0 -14
- data/demo_rack_apps/Rails_4.0.1/config/routes.rb +0 -60
- data/demo_rack_apps/Rails_4.0.1/db/migrate/20131102201320_create_projects.rb +0 -11
- data/demo_rack_apps/Rails_4.0.1/db/migrate/20131102201321_create_tasks.rb +0 -11
- data/demo_rack_apps/Rails_4.0.1/db/schema.rb +0 -32
- data/demo_rack_apps/Rails_4.0.1/db/seeds.rb +0 -15
- data/demo_rack_apps/Rails_4.0.1/test/controllers/projects_controller_test.rb +0 -49
- data/demo_rack_apps/Rails_4.0.1/test/controllers/tasks_controller_test.rb +0 -49
- data/demo_rack_apps/Rails_4.0.1/test/helpers/projects_helper_test.rb +0 -4
- data/demo_rack_apps/Rails_4.0.1/test/helpers/tasks_helper_test.rb +0 -4
- data/demo_rack_apps/Rails_4.0.1/test/models/project_test.rb +0 -7
- data/demo_rack_apps/Rails_4.0.1/test/models/task_test.rb +0 -7
- data/demo_rack_apps/Rails_4.0.1/test/test_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0322a9bc39fa60cc33477bfcdff560519400aed3
|
4
|
+
data.tar.gz: c3e0738e1466e9c871edd03e59669cff5bcd0dbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470676c568c368c51640fbaff41388797f1bf67c623cf984734c1e28db82f6ed9605b4b27fdef87a4256d90d0851d7672224b37387c5bd6c4802d1c00cf3061d
|
7
|
+
data.tar.gz: 8c5292291c5b64fff7bdf36deada58a7e39b68fc1e3af6fe0f099b9519d1f6d2cc1da9a03ca37d3a65e4497664d493c10dcff689027a95bea904303d581becdd
|
data/CHANGELOG.markdown
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
11
|
+
distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
14
|
+
owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
17
|
+
that control, are controlled by, or are under common control with that entity.
|
18
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
19
|
+
indirect, to cause the direction or management of such entity, whether by
|
20
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
24
|
+
permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications, including
|
27
|
+
but not limited to software source code, documentation source, and configuration
|
28
|
+
files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
31
|
+
translation of a Source form, including but not limited to compiled object code,
|
32
|
+
generated documentation, and conversions to other media types.
|
33
|
+
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
35
|
+
available under the License, as indicated by a copyright notice that is included
|
36
|
+
in or attached to the work (an example is provided in the Appendix below).
|
37
|
+
|
38
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
39
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
40
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
41
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
42
|
+
shall not include works that remain separable from, or merely link (or bind by
|
43
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
44
|
+
|
45
|
+
"Contribution" shall mean any work of authorship, including the original version
|
46
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
47
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
48
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
49
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
50
|
+
"submitted" means any form of electronic, verbal, or written communication sent
|
51
|
+
to the Licensor or its representatives, including but not limited to
|
52
|
+
communication on electronic mailing lists, source code control systems, and
|
53
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
54
|
+
the purpose of discussing and improving the Work, but excluding communication
|
55
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
56
|
+
owner as "Not a Contribution."
|
57
|
+
|
58
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
59
|
+
of whom a Contribution has been received by Licensor and subsequently
|
60
|
+
incorporated within the Work.
|
61
|
+
|
62
|
+
2. Grant of Copyright License.
|
63
|
+
|
64
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
65
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
66
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
68
|
+
Derivative Works in Source or Object form.
|
69
|
+
|
70
|
+
3. Grant of Patent License.
|
71
|
+
|
72
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
73
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
74
|
+
irrevocable (except as stated in this section) patent license to make, have
|
75
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
76
|
+
such license applies only to those patent claims licensable by such Contributor
|
77
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
78
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
79
|
+
submitted. If You institute patent litigation against any entity (including a
|
80
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
81
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
82
|
+
patent infringement, then any patent licenses granted to You under this License
|
83
|
+
for that Work shall terminate as of the date such litigation is filed.
|
84
|
+
|
85
|
+
4. Redistribution.
|
86
|
+
|
87
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
88
|
+
in any medium, with or without modifications, and in Source or Object form,
|
89
|
+
provided that You meet the following conditions:
|
90
|
+
|
91
|
+
You must give any other recipients of the Work or Derivative Works a copy of
|
92
|
+
this License; and
|
93
|
+
You must cause any modified files to carry prominent notices stating that You
|
94
|
+
changed the files; and
|
95
|
+
You must retain, in the Source form of any Derivative Works that You distribute,
|
96
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
97
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
98
|
+
Derivative Works; and
|
99
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
100
|
+
Derivative Works that You distribute must include a readable copy of the
|
101
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
102
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
103
|
+
following places: within a NOTICE text file distributed as part of the
|
104
|
+
Derivative Works; within the Source form or documentation, if provided along
|
105
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
106
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
107
|
+
the NOTICE file are for informational purposes only and do not modify the
|
108
|
+
License. You may add Your own attribution notices within Derivative Works that
|
109
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
110
|
+
provided that such additional attribution notices cannot be construed as
|
111
|
+
modifying the License.
|
112
|
+
You may add Your own copyright statement to Your modifications and may provide
|
113
|
+
additional or different license terms and conditions for use, reproduction, or
|
114
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
115
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
116
|
+
with the conditions stated in this License.
|
117
|
+
|
118
|
+
5. Submission of Contributions.
|
119
|
+
|
120
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
121
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
122
|
+
conditions of this License, without any additional terms or conditions.
|
123
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
124
|
+
any separate license agreement you may have executed with Licensor regarding
|
125
|
+
such Contributions.
|
126
|
+
|
127
|
+
6. Trademarks.
|
128
|
+
|
129
|
+
This License does not grant permission to use the trade names, trademarks,
|
130
|
+
service marks, or product names of the Licensor, except as required for
|
131
|
+
reasonable and customary use in describing the origin of the Work and
|
132
|
+
reproducing the content of the NOTICE file.
|
133
|
+
|
134
|
+
7. Disclaimer of Warranty.
|
135
|
+
|
136
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
137
|
+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
138
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
139
|
+
including, without limitation, any warranties or conditions of TITLE,
|
140
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
141
|
+
solely responsible for determining the appropriateness of using or
|
142
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
143
|
+
permissions under this License.
|
144
|
+
|
145
|
+
8. Limitation of Liability.
|
146
|
+
|
147
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
148
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
149
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
150
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
151
|
+
or consequential damages of any character arising as a result of this License or
|
152
|
+
out of the use or inability to use the Work (including but not limited to
|
153
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
154
|
+
any and all other commercial damages or losses), even if such Contributor has
|
155
|
+
been advised of the possibility of such damages.
|
156
|
+
|
157
|
+
9. Accepting Warranty or Additional Liability.
|
158
|
+
|
159
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
160
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
161
|
+
other liability obligations and/or rights consistent with this License. However,
|
162
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
163
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
164
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
165
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
166
|
+
accepting any such warranty or additional liability.
|
167
|
+
|
168
|
+
END OF TERMS AND CONDITIONS
|
169
|
+
|
170
|
+
APPENDIX: How to apply the Apache License to your work
|
171
|
+
|
172
|
+
To apply the Apache License to your work, attach the following boilerplate
|
173
|
+
notice, with the fields enclosed by brackets "{}" replaced with your own
|
174
|
+
identifying information. (Don't include the brackets!) The text should be
|
175
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
176
|
+
recommend that a file or class name and description of purpose be included on
|
177
|
+
the same "printed page" as the copyright notice for easier identification within
|
178
|
+
third-party archives.
|
179
|
+
|
180
|
+
Copyright {yyyy} {name of copyright owner}
|
181
|
+
|
182
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
183
|
+
you may not use this file except in compliance with the License.
|
184
|
+
You may obtain a copy of the License at
|
185
|
+
|
186
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
187
|
+
|
188
|
+
Unless required by applicable law or agreed to in writing, software
|
189
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
190
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
191
|
+
See the License for the specific language governing permissions and
|
192
|
+
limitations under the License.
|
193
|
+
|
194
|
+
|
195
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
Rack AllocationStats [![Build Status](https://travis-ci.org/srawlins/rack-allocation_stats.png?branch=master)](https://travis-ci.org/srawlins/rack-allocation_stats)
|
2
|
+
====================
|
3
|
+
|
4
|
+
Rack AllocationStats is a Rack Middleware, similar in design to
|
5
|
+
[rack-perftools_profiler](https://github.com/bhb/rack-perftools_profiler), that
|
6
|
+
will show information about object allocations that occurr during an HTTP
|
7
|
+
request. The heart of Rack AllocationStats is the
|
8
|
+
[AllocationStats](https://github.com/srawlins/allocation_stats) gem. Install
|
9
|
+
Rack AllocationStats with Ruby 2.1 (newer than preview1) and:
|
10
|
+
|
11
|
+
* Bundler: add `gem 'rack-allocation_stats'` to your Gemfile, or
|
12
|
+
* RubyGems: run `gem install rack-allocation_stats`
|
13
|
+
|
14
|
+
Rack AllocationStats must also be included in your Rack application's middleware:
|
15
|
+
|
16
|
+
Rails:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# in your config/application.rb
|
20
|
+
config.middleware.use ::Rack::AllocationStats
|
21
|
+
```
|
22
|
+
|
23
|
+
Other Rack apps:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# in your rackup file
|
27
|
+
use Rack::AllocationStats
|
28
|
+
```
|
29
|
+
|
30
|
+
Summary
|
31
|
+
=======
|
32
|
+
|
33
|
+
In order to trigger Rack AllocationStats, a parameter must be appended to the
|
34
|
+
request URL: `ras[trace]=true` ('ras' for Rack AllocationStats). This will
|
35
|
+
trace the object allocations that occur inside your Rack app during your
|
36
|
+
request.
|
37
|
+
|
38
|
+
For example, if you have a Rack app that responds to the following request:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
http://my.rack.app:9292/path?foo=bar
|
42
|
+
```
|
43
|
+
|
44
|
+
then you can just add `&ras[trace]=true` to activate Rack AllocationStats:
|
45
|
+
|
46
|
+
```bash
|
47
|
+
http://my.rack.app:9292/path?foo=bar&ras[trace]=true
|
48
|
+
```
|
49
|
+
|
50
|
+
Instead of the normal response that your app generates, Rack
|
51
|
+
AllocationStats will respond with a tabular listing of allocation statistics.
|
52
|
+
|
53
|
+
![Demonstration](basic-screen.gif)
|
54
|
+
|
55
|
+
There are additional paramters that you can attach to the request URL to change
|
56
|
+
the response:
|
57
|
+
|
58
|
+
Help text
|
59
|
+
=========
|
60
|
+
|
61
|
+
To see some help text on what options are available, use `ras[trace]=true`, and
|
62
|
+
also add `ras[help]`. Rack AllocationStats will respond with man page-style
|
63
|
+
help text.
|
64
|
+
|
65
|
+
Limit the file system scope
|
66
|
+
===========================
|
67
|
+
|
68
|
+
If you only wish to see allocations that originate from a certain directory, you can
|
69
|
+
use the `ras[scope]` parameter. For example:
|
70
|
+
|
71
|
+
* To limit the list of allocations to those with a `sourcefile` that includes
|
72
|
+
`yajl`, append to the location:
|
73
|
+
```
|
74
|
+
?ras[trace]=true&ras[scope]=yajl
|
75
|
+
```
|
76
|
+
|
77
|
+
* To limit the list of allocations to those in the present working directory.
|
78
|
+
`.` is a special value for `ras[scope]` that is expanded to the full path of
|
79
|
+
the present working directory, append to the location:
|
80
|
+
```
|
81
|
+
?ras[trace]=true&ras[scope]=.
|
82
|
+
```
|
83
|
+
|
84
|
+
Alias paths
|
85
|
+
===========
|
86
|
+
|
87
|
+
In order to reduce the with of the `sourcefile`, you can add
|
88
|
+
`ras[alias_paths]=true`, which will shorten paths in the following directories:
|
89
|
+
|
90
|
+
* your present working directory (to be replaced with `<PWD>`)
|
91
|
+
* Ruby's `lib` directory (to be replaced with `<RUBYLIBDIR>`)
|
92
|
+
* the Gem directory, where installed gems live (eg: sqlite3-1.3.8 to be
|
93
|
+
replaced with `<GEM:sqlite3-1.3.8>`)
|
94
|
+
|
95
|
+
Change the output
|
96
|
+
=================
|
97
|
+
|
98
|
+
There are several values that you can pass with `ras[output]` parameter:
|
99
|
+
|
100
|
+
* `columnar` is the default response output, displaying allocation groups in
|
101
|
+
text columns.
|
102
|
+
* `json` will respond with a JSON string representing all of the groups of
|
103
|
+
allocations (by default grouped by sourcefile, sourceline, and object class).
|
104
|
+
* `interactive` will respond with a JavaScript application that allows you to
|
105
|
+
interactively tweak how you wish to group, arrange, and filter the traced
|
106
|
+
allocations.
|
107
|
+
|
108
|
+
Request multiple times
|
109
|
+
======================
|
110
|
+
|
111
|
+
If your Rack application appears to have some variability, you can use
|
112
|
+
`ras[times]=N` to pass the request onto your Rack application `N` times. The
|
113
|
+
response that Rack AllocationStats generates will contain all of the requests
|
114
|
+
that occurred over the `N` requests.
|
data/TODO.markdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
* README
|
2
|
+
|
3
|
+
Interactive Mode
|
4
|
+
================
|
5
|
+
|
6
|
+
* option to divide counts by ras[times]
|
7
|
+
* filter out specific gem
|
8
|
+
* add sinatra example / spec
|
9
|
+
* sorting ability
|
10
|
+
* linkify ruby code
|
11
|
+
* count pct choice
|
12
|
+
* group by custom
|
13
|
+
* display all ras[] parameters
|
14
|
+
(where? they're all in the location bar for now...)
|
15
|
+
* jasmine specs:
|
16
|
+
* `byFileLineAndClassPlus()`
|
17
|
+
* `fillClassAbbreviations()`
|
18
|
+
* `filterOutGems()`
|
19
|
+
* `filterOutEval()`
|
20
|
+
* `filterAllocationsByControls()`
|
21
|
+
* `groupByFields()`
|
22
|
+
* `minCount()` ?
|
23
|
+
* `tupleize()`
|
24
|
+
|
25
|
+
Output
|
26
|
+
======
|
27
|
+
|
28
|
+
* add `ras[output]=csv`
|
29
|
+
* add `ras[group_by]=...`
|
30
|
+
* add `ras[detail]=percent`
|
31
|
+
* add `ras[burn]=BURN`
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Rack AllocationStats help
|
2
|
+
|
3
|
+
Append ras[trace]=true to your URL to trace all object allocations during the
|
4
|
+
request. The server will respond with statistics on the allocations, instead of
|
5
|
+
the application's response.
|
6
|
+
|
7
|
+
Options
|
8
|
+
|
9
|
+
ras[times]=COUNT
|
10
|
+
send the request to the application COUNT times, to reduce statistics from
|
11
|
+
initial allocations that don't happen on repeat requests.
|
12
|
+
|
13
|
+
ras[help]
|
14
|
+
immediately respond with this help text
|
15
|
+
|
16
|
+
ras[scope]=SCOPE
|
17
|
+
limit the list of allocations in the response to those whose `sourcefile`
|
18
|
+
matches SCOPE. ras[scope]='.' is a special case which is expanded to be
|
19
|
+
the current working directory.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/* Copyright 2013 Google Inc. All Rights Reserved.
|
2
|
+
* Licensed under the Apache License, Version 2.0, found in the LICENSE file.
|
3
|
+
*/
|
4
|
+
|
5
|
+
var allocations = <%= Yajl::Encoder.encode(@allocations) %>;
|
6
|
+
var pwd = "<%= Dir.pwd %>";
|
7
|
+
var classAbbreviations = {};
|
8
|
+
|
9
|
+
$(function() {
|
10
|
+
fillClassAbbreviations();
|
11
|
+
|
12
|
+
fillTableWith(
|
13
|
+
_.sortBy(
|
14
|
+
tupleize(_.groupBy(filterAllocationsByControls(), byFileLineAndClassPlus)),
|
15
|
+
valueLength
|
16
|
+
),
|
17
|
+
["file", "line", "class+ (abbrev)"]
|
18
|
+
);
|
19
|
+
|
20
|
+
$("#gb-controls input").change(refillTable);
|
21
|
+
$("#filter-controls input").change(refillTable);
|
22
|
+
$("#filter-count").change(refillTable);
|
23
|
+
$("#option-abbreviate-classes").change(refillTable);
|
24
|
+
});
|
@@ -0,0 +1,109 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rack::AllocationStats</title>
|
5
|
+
|
6
|
+
<script>
|
7
|
+
<%= jquery_min_js %>
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
<%= jquery_ui_min_js %>
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script>
|
15
|
+
<%= underscore_min_js %>
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<script>
|
19
|
+
<%= interactive_js %>
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
<%= allocations_js %>
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<style>
|
27
|
+
<%= jquery_ui_min_css %>
|
28
|
+
</style>
|
29
|
+
|
30
|
+
<style>
|
31
|
+
<%= style_css %>
|
32
|
+
</style>
|
33
|
+
|
34
|
+
<script>
|
35
|
+
$(function() {
|
36
|
+
var spinnerStart = Math.max(getParameterByName("ras[times]")*1, 1);
|
37
|
+
$("#filter-count").
|
38
|
+
val(spinnerStart).
|
39
|
+
spinner({
|
40
|
+
step: spinnerStart,
|
41
|
+
spin: function(event, ui) {
|
42
|
+
if (ui.value < 1 ) { $(this).spinner("value", 1); return false; }
|
43
|
+
},
|
44
|
+
change: refillTable,
|
45
|
+
stop: refillTable
|
46
|
+
});
|
47
|
+
});
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
<main id="everything">
|
52
|
+
<h1>Rack::AllocationStats</h1>
|
53
|
+
<% if defined?(Rails) && Rails.env != "production" %>
|
54
|
+
<div class="warning">
|
55
|
+
Warning: This Rails app is running in <strong><%= Rails.env %></strong>
|
56
|
+
mode. You should only run Rack::AllocationStats against a Rails app in
|
57
|
+
<strong>production</strong> mode; the allocations below will be
|
58
|
+
<em>significantly</em> different (fewer).
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
|
62
|
+
<section id="controls">
|
63
|
+
<section id="gb-controls">
|
64
|
+
group by:
|
65
|
+
<label for="gb-file"><input type="checkbox" id="gb-file" name="file" checked="checked"></input>file</label>
|
66
|
+
<label for="gb-line"><input type="checkbox" id="gb-line" name="line" checked="checked"></input>line</label>
|
67
|
+
<label for="gb-class-path"><input type="checkbox" id="gb-class-path" name="class_path"></input>class path</label>
|
68
|
+
<label for="gb-method-id"><input type="checkbox" id="gb-method-id" name="method_id"></input>method id</label>
|
69
|
+
<label for="gb-class"><input type="checkbox" id="gb-class" name="class"></input>class</label>
|
70
|
+
<label for="gb-class-plus"><input type="checkbox" id="gb-class-plus" name="class_plus" checked="checked"></input>class+</label>
|
71
|
+
</section>
|
72
|
+
|
73
|
+
<section id="filter-controls">
|
74
|
+
<div>
|
75
|
+
filter out:
|
76
|
+
<label for="filter-ruby"><input type="checkbox" id="filter-ruby" name="filter-ruby"></input>ruby</label>
|
77
|
+
<label for="filter-gems"><input type="checkbox" id="filter-gems" name="filter-gems"></input>gems</label>
|
78
|
+
<label for="filter-pwd"><input type="checkbox" id="filter-pwd" name="filter-pwd"></input>project (PWD)</label>
|
79
|
+
<label for="filter-eval"><input type="checkbox" id="filter-eval" name="filter-eval" checked="checked"></input>(eval)</label>
|
80
|
+
</div>
|
81
|
+
<!--div>
|
82
|
+
specific gems:
|
83
|
+
<% allocating_gems.each do |allocating_gem| %>
|
84
|
+
<%= allocating_gem %>
|
85
|
+
<% end %>
|
86
|
+
</div-->
|
87
|
+
</section>
|
88
|
+
|
89
|
+
<section id="filter-controls">
|
90
|
+
only groups with at least:
|
91
|
+
<input type="text" id="filter-count" name="filter-count" />
|
92
|
+
allocations
|
93
|
+
</section>
|
94
|
+
|
95
|
+
<section id="option-controls">
|
96
|
+
<label for="option-abbreviate-classes">
|
97
|
+
<input type="checkbox" id="option-abbreviate-classes" name="option-abbreviate-classes" checked="checked"></input>abbreviate classes
|
98
|
+
</label>
|
99
|
+
</section>
|
100
|
+
</section>
|
101
|
+
|
102
|
+
<table id="allocations" cellpadding="0" cellspacing="0">
|
103
|
+
<thead></thead>
|
104
|
+
<tbody></tbody>
|
105
|
+
</table>
|
106
|
+
<div id="allocations-row-count"></div>
|
107
|
+
</main>
|
108
|
+
</body>
|
109
|
+
</html>
|