Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
29e37d9b
Commit
29e37d9b
authored
Feb 14, 2016
by
Sasha Goldshtein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic changes: removed .py suffix, fixed link in README
parent
61f5535f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
README.md
README.md
+1
-1
tools/memleak.py
tools/memleak.py
+9
-9
tools/memleak_examples.txt
tools/memleak_examples.txt
+14
-14
No files found.
README.md
View file @
29e37d9b
...
...
@@ -65,7 +65,7 @@ Examples:
Tools:
-
tools/
[
argdist
](
tools/argdist.py
)
: Display function parameter values as a histogram or frequency count.
[
Examples
](
tools/argdist_example.txt
)
.
-
tools/
[
argdist
](
tools/argdist.py
)
: Display function parameter values as a histogram or frequency count.
[
Examples
](
tools/argdist_example
s
.txt
)
.
-
tools/
[
bashreadline
](
tools/bashreadline.py
)
: Print entered bash commands system wide.
[
Examples
](
tools/bashreadline_example.txt
)
.
-
tools/
[
biolatency
](
tools/biolatency.py
)
: Summarize block device I/O latency as a histogram.
[
Examples
](
tools/biolatency_example.txt
)
.
-
tools/
[
biotop
](
tools/biotop.py
)
: Top for disks: Summarize block device I/O by process.
[
Examples
](
tools/biotop_example.txt
)
.
...
...
tools/memleak.py
View file @
29e37d9b
#!/usr/bin/env python
#
# memleak
.py
Trace and display outstanding allocations to detect
# memleak Trace and display outstanding allocations to detect
# memory leaks in user-mode processes and the kernel.
#
# USAGE: memleak
.py
[-h] [-p PID] [-t] [-a] [-o OLDER] [-c COMMAND]
# USAGE: memleak [-h] [-p PID] [-t] [-a] [-o OLDER] [-c COMMAND]
# [-s SAMPLE_RATE] [-d STACK_DEPTH] [-T TOP] [-z MIN_SIZE]
# [-Z MAX_SIZE]
# [interval] [count]
...
...
@@ -157,23 +157,23 @@ def run_command_get_pid(command):
examples
=
"""
EXAMPLES:
./memleak
.py
-p $(pidof allocs)
./memleak -p $(pidof allocs)
Trace allocations and display a summary of "leaked" (outstanding)
allocations every 5 seconds
./memleak
.py
-p $(pidof allocs) -t
./memleak -p $(pidof allocs) -t
Trace allocations and display each individual call to malloc/free
./memleak
.py
-ap $(pidof allocs) 10
./memleak -ap $(pidof allocs) 10
Trace allocations and display allocated addresses, sizes, and stacks
every 10 seconds for outstanding allocations
./memleak
.py
-c "./allocs"
./memleak -c "./allocs"
Run the specified command and trace its allocations
./memleak
.py
./memleak
Trace allocations in kernel mode and display a summary of outstanding
allocations every 5 seconds
./memleak
.py
-o 60000
./memleak -o 60000
Trace allocations in kernel mode and display a summary of outstanding
allocations that are at least one minute (60 seconds) old
./memleak
.py
-s 5
./memleak -s 5
Trace roughly every 5th allocation, to reduce overhead
"""
...
...
tools/memleak_examples.txt
View file @
29e37d9b
...
...
@@ -6,7 +6,7 @@ collects call stacks for each allocation. memleak can then print a summary
of which call stacks performed allocations that weren't subsequently freed.
For example:
# ./memleak
.py
-p $(pidof allocs)
# ./memleak -p $(pidof allocs)
Attaching to malloc and free in pid 5193, Ctrl+C to quit.
[11:16:33] Top 2 stacks with outstanding allocations:
80 bytes in 5 allocations from stack
...
...
@@ -32,7 +32,7 @@ Occasionally, you do want the individual allocation details. Perhaps the same
stack is allocating various sizes and you want to confirm which sizes are
prevalent. Use the -a switch:
# ./memleak
.py
-p $(pidof allocs) -a
# ./memleak -p $(pidof allocs) -a
Attaching to malloc and free in pid 5193, Ctrl+C to quit.
[11:16:33] Top 2 stacks with outstanding allocations:
addr = 948cd0 size = 16
...
...
@@ -63,7 +63,7 @@ When using the -p switch, memleak traces the allocations of a particular
process. Without this switch, kernel allocations (kmalloc) are traced instead.
For example:
# ./memleak
.py
# ./memleak
Attaching to kmalloc and kfree, Ctrl+C to quit.
...
248 bytes in 4 allocations from stack
...
...
@@ -114,7 +114,7 @@ interval, pass the interval as a positional parameter to memleak. You can
also control the number of times the output will be printed before exiting.
For example:
# ./memleak
.py
1 10
# ./memleak 1 10
... will print the outstanding allocation statistics every second, for ten
times, and then exit.
...
...
@@ -125,7 +125,7 @@ control the overhead by sampling every N-th allocation. For example, to sample
roughly 10% of the allocations and print the outstanding allocations every 5
seconds, 3 times before quitting:
# ./memleak
.py
-p $(pidof allocs) -s 10 5 3
# ./memleak -p $(pidof allocs) -s 10 5 3
Attaching to malloc and free in pid 2614, Ctrl+C to quit.
[11:16:33] Top 2 stacks with outstanding allocations:
16 bytes in 1 allocations from stack
...
...
@@ -149,8 +149,8 @@ of the sampling rate applied.
USAGE message:
# ./memleak
.py
-h
usage: memleak
.py
[-h] [-p PID] [-t] [-a] [-o OLDER] [-c COMMAND]
# ./memleak -h
usage: memleak [-h] [-p PID] [-t] [-a] [-o OLDER] [-c COMMAND]
[-s SAMPLE_RATE] [-d STACK_DEPTH] [-T TOP]
[interval] [count]
...
...
@@ -185,21 +185,21 @@ optional arguments:
EXAMPLES:
./memleak
.py
-p $(pidof allocs)
./memleak -p $(pidof allocs)
Trace allocations and display a summary of "leaked" (outstanding)
allocations every 5 seconds
./memleak
.py
-p $(pidof allocs) -t
./memleak -p $(pidof allocs) -t
Trace allocations and display each individual call to malloc/free
./memleak
.py
-ap $(pidof allocs) 10
./memleak -ap $(pidof allocs) 10
Trace allocations and display allocated addresses, sizes, and stacks
every 10 seconds for outstanding allocations
./memleak
.py
-c "./allocs"
./memleak -c "./allocs"
Run the specified command and trace its allocations
./memleak
.py
./memleak
Trace allocations in kernel mode and display a summary of outstanding
allocations every 5 seconds
./memleak
.py
-o 60000
./memleak -o 60000
Trace allocations in kernel mode and display a summary of outstanding
allocations that are at least one minute (60 seconds) old
./memleak
.py
-s 5
./memleak -s 5
Trace roughly every 5th allocation, to reduce overhead
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