From 29e37d9b2784051b767e3782d2511fbf989c80ae Mon Sep 17 00:00:00 2001 From: Sasha Goldshtein <goldshtn@gmail.com> Date: Sun, 14 Feb 2016 06:56:07 -0800 Subject: [PATCH] Cosmetic changes: removed .py suffix, fixed link in README --- README.md | 2 +- tools/memleak.py | 18 +++++++++--------- tools/memleak_examples.txt | 28 ++++++++++++++-------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c5f0dff0..0e26146d 100644 --- a/README.md +++ b/README.md @@ -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_examples.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). diff --git a/tools/memleak.py b/tools/memleak.py index 9227459a..71000506 100755 --- a/tools/memleak.py +++ b/tools/memleak.py @@ -1,9 +1,9 @@ #!/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 """ diff --git a/tools/memleak_examples.txt b/tools/memleak_examples.txt index 82a01b07..d8df388c 100644 --- a/tools/memleak_examples.txt +++ b/tools/memleak_examples.txt @@ -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 -- 2.30.9