Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
36890b3f
Commit
36890b3f
authored
Jul 15, 2020
by
Thong Kuah
Committed by
Marcia Ramos
Jul 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable raw stackprof collection for flamegraphs
Also add documentation on how to generate flamegraphs.
parent
fb650c46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
bin/rspec-stackprof
bin/rspec-stackprof
+2
-1
doc/development/performance.md
doc/development/performance.md
+20
-1
No files found.
bin/rspec-stackprof
View file @
36890b3f
...
...
@@ -8,9 +8,10 @@ require 'spec_helper'
filename
=
ARGV
[
0
].
split
(
'/'
).
last
interval
=
ENV
.
fetch
(
'INTERVAL'
,
1000
).
to_i
limit
=
ENV
.
fetch
(
'LIMIT'
,
20
)
raw
=
ENV
.
fetch
(
'RAW'
,
false
)
==
'true'
output_file
=
"tmp/
#{
filename
}
.dump"
StackProf
.
run
(
mode: :wall
,
out:
output_file
,
interval:
interval
)
do
StackProf
.
run
(
mode: :wall
,
out:
output_file
,
interval:
interval
,
raw:
raw
)
do
RSpec
::
Core
::
Runner
.
run
(
ARGV
,
$stderr
,
$stdout
)
end
...
...
doc/development/performance.md
View file @
36890b3f
...
...
@@ -173,11 +173,30 @@ dot -Tsvg project_policy_spec.dot > project_policy_spec.svg
To load the profile in
[
kcachegrind
](
https://kcachegrind.github.io/
)
:
```
shell
stackprof tmp/project_policy_spec.dump
--callgrind
>
project_policy_spec.callgrind
stackprof tmp/project_policy_spec.
rb.
dump
--callgrind
>
project_policy_spec.callgrind
kcachegrind project_policy_spec.callgrind
# Linux
qcachegrind project_policy_spec.callgrind
# Mac
```
For flamegraphs, enable raw collection first. Note that raw
collection can generate a very large file, so increase the
`INTERVAL`
, or
run on a smaller number of specs for smaller file size:
```
shell
RAW
=
true
bin/rspec-stackprof spec/policies/group_member_policy_spec.rb
```
You can then generate, and view the resultant flamegraph. It might take a
while to generate based on the output file size:
```
shell
# Generate
stackprof
--flamegraph
tmp/group_member_policy_spec.rb.dump
>
group_member_policy_spec.flame
# View
stackprof
--flamegraph-viewer
=
group_member_policy_spec.flame
```
It may be useful to zoom in on a specific method, for example:
```
shell
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment