Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
905d1cb8
Commit
905d1cb8
authored
6 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Make the blacklist an option
parent
708b853f
No related branches found
No related tags found
1 merge request
!757
Memory allocations logger
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/analyse_memuse_logs.py
+26
-15
26 additions, 15 deletions
tools/analyse_memuse_logs.py
with
26 additions
and
15 deletions
tools/analyse_memuse_logs.py
+
26
−
15
View file @
905d1cb8
#!/usr/bin/env python
"""
Usage:
process_memuse.py memuse_report1.dat [memuse_report2.dat] ...
process_memuse.py
[options]
memuse_report1.dat [memuse_report2.dat] ...
Parse the output of a run of SWIFT to convert the memuse output dumps into a
timeseries of memory use. Also outputs use in memory per labelled type.
...
...
@@ -23,13 +23,24 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import
sys
from
collections
import
OrderedDict
import
argparse
import
sys
# Command-line arguments.
if
len
(
sys
.
argv
)
<
2
:
print
"
usage:
"
,
sys
.
argv
[
0
],
"
memuse_report1.dat [memuse_report2.dat] ...
"
sys
.
exit
(
1
)
parser
=
argparse
.
ArgumentParser
(
description
=
"
Analyse memory usage reports
"
)
parser
.
add_argument
(
"
memuse_report
"
,
nargs
=
'
+
'
,
help
=
"
Memory usage reports (order by step if using more than one)
"
)
parser
.
add_argument
(
"
-b
"
,
"
--blacklist
"
,
dest
=
"
blacklist
"
,
help
=
"
substring of allocations to ignore (maybe be repeated)
"
,
default
=
None
,
action
=
'
append
'
)
args
=
parser
.
parse_args
()
memuse
=
OrderedDict
()
labels
=
{}
...
...
@@ -37,9 +48,7 @@ totalmem = 0
process_use
=
""
peak
=
0.0
blacklist
=
[
"
sort
"
,
"
temp
"
]
for
filename
in
sys
.
argv
[
1
:]:
for
filename
in
args
.
memuse_report
:
sys
.
stderr
.
write
(
"
## Processing:
"
+
filename
+
"
\n
"
)
with
open
(
filename
)
as
infile
:
print
'
# {:<18s} {:>30s} {:>9s} {:>9s} {:s}
'
.
format
(
"
tic
"
,
"
label
"
,
"
allocated
"
,
"
step
"
,
"
MB
"
)
...
...
@@ -51,13 +60,15 @@ for filename in sys.argv[1:]:
tic
,
adr
,
rank
,
step
,
allocated
,
label
,
size
=
line
.
split
()
# Skip blacklisted allocations, these can swamp the signal...
skip
=
False
for
item
in
blacklist
:
if
item
in
label
:
skip
=
True
break
if
skip
:
continue
if
args
.
blacklist
!=
None
:
skip
=
False
for
item
in
args
.
blacklist
:
if
item
in
label
:
skip
=
True
break
if
skip
:
continue
rank
=
int
(
rank
)
step
=
int
(
step
)
allocated
=
int
(
allocated
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment