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
1eb58004
Commit
1eb58004
authored
Dec 07, 2017
by
Julien Muchembled
Committed by
Kirill Smelkov
Jan 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shmtop: New tool to show who uses /dev/shm the most
parent
27936225
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
shmtop
shmtop
+36
-0
No files found.
shmtop
0 → 100755
View file @
1eb58004
#!/usr/bin/python
import
errno
,
os
,
pwd
os
.
chdir
(
'/proc'
)
z
=
[]
for
p
in
os
.
listdir
(
'.'
):
try
:
pid
=
int
(
p
)
except
ValueError
:
continue
n
=
0
x
=
p
+
'/fd'
try
:
for
y
in
os
.
listdir
(
x
):
y
=
x
+
'/'
+
y
if
os
.
readlink
(
y
).
startswith
(
'/dev/shm/'
):
y
=
os
.
open
(
y
,
0
)
try
:
n
+=
os
.
fstat
(
y
).
st_blocks
finally
:
os
.
close
(
y
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
if
n
:
try
:
with
open
(
p
+
'/status'
)
as
x
:
x
=
dict
(
x
.
split
(
':'
,
1
)
for
x
in
x
)
except
IOError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
continue
uid
=
map
(
int
,
x
[
'Uid'
].
split
())
z
.
append
((
pwd
.
getpwuid
(
uid
[
0
]).
pw_name
,
x
[
'Name'
].
strip
(),
pid
,
n
))
z
.
sort
(
key
=
lambda
x
:
x
[
3
])
from
pprint
import
pprint
as
pp
pp
(
z
)
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