Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devops
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
0
Merge Requests
0
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
Kirill Smelkov
devops
Commits
13c8c87c
Commit
13c8c87c
authored
Sep 20, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pymprof: Tool to collect memory profile of a running Python process
parent
f9ae1831
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
mprof.py
mprof.py
+19
-0
pymprof
pymprof
+10
-0
No files found.
mprof.py
0 → 100644
View file @
13c8c87c
# pyrasite payload to collect memory profile for <t> seconds
t
=
10
from
golang
import
go
import
tracemalloc
,
time
,
sys
def
mprof
(
t
):
print
(
"
\
n
mprof start ..."
)
tracemalloc
.
start
()
time
.
sleep
(
t
)
snapshot
=
tracemalloc
.
take_snapshot
()
tracemalloc
.
stop
()
top_stats
=
snapshot
.
statistics
(
'lineno'
)
print
(
'
\
n
mprof: [ Top 10 ]'
)
for
stat
in
top_stats
[:
10
]:
print
(
stat
)
sys
.
stdout
.
flush
()
go
(
mprof
,
t
)
pymprof
0 → 100755
View file @
13c8c87c
#!/bin/sh
# pymprof <pid> -- collect/print memory profile from a running Python program
#
# The output is collected in a spawned thread in the target process and then is
# sent to program's stdout. Pymprof only spawns that thread and does not wait
# for its completion.
#
# see also pyinject.gdb
pyrasite
$1
mprof.py
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