Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
ghc-utils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ben Gamari
ghc-utils
Commits
f9207038
Commit
f9207038
authored
Jan 11, 2021
by
Ben Gamari
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ghc_timings: Introduce it
parent
e1b75039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
README.md
README.md
+1
-0
ghc_timings.py
ghc_timings.py
+31
-0
No files found.
README.md
View file @
f9207038
...
...
@@ -43,6 +43,7 @@ the scripts are available using `nix-shell`.
profiler.
*
`eventlog-sort`
: A hack to dump the events from a GHC eventlog with relative
timestamps (in milliseconds).
*
`ghc_timings.py`
: A small hack to turn
`-ddump-timings`
output into a Markdown table.
## Release engineering
...
...
ghc_timings.py
0 → 100644
View file @
f9207038
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
re
import
sys
import
typing
from
typing
import
Iterator
class
Timing
(
typing
.
NamedTuple
):
phase
:
str
module
:
str
time
:
float
allocd
:
float
def
parse_timings
(
s
:
str
)
->
Iterator
[
Timing
]:
for
m
in
re
.
finditer
(
r'!!! ([\w \d]+) \[([\w\d_\.]+)\]: finished in (\d+\.\d+) milliseconds, allocated (\d+\.\d+) megabytes'
,
s
):
phase
=
m
.
group
(
1
)
module
=
m
.
group
(
2
)
time
=
float
(
m
.
group
(
3
))
allocd
=
float
(
m
.
group
(
4
))
yield
Timing
(
phase
,
module
,
time
,
allocd
)
def
main
()
->
None
:
s
=
sys
.
stdin
.
read
()
print
(
'| module | phase | time (ms) | alloc (MB) |'
)
print
(
'| ------ | ----- | --------- | ---------- |'
)
for
t
in
parse_timings
(
s
):
print
(
'| {module} | {phase} | {time} | {allocd} |'
.
format
(
**
t
))
if
__name__
==
'__main__'
:
main
()
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