tools/mm/slabinfo-gnuplot.sh
Source file repositories/reference/linux-study-clean/tools/mm/slabinfo-gnuplot.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/mm/slabinfo-gnuplot.sh- Extension
.sh- Size
- 4821 bytes
- Lines
- 269
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
# Sergey Senozhatsky, 2015
# sergey.senozhatsky.work@gmail.com
#
# This program is intended to plot a `slabinfo -X' stats, collected,
# for example, using the following command:
# while [ 1 ]; do slabinfo -X >> stats; sleep 1; done
#
# Use `slabinfo-gnuplot.sh stats' to pre-process collected records
# and generate graphs (totals, slabs sorted by size, slabs sorted
# by size).
#
# Graphs can be [individually] regenerate with different ranges and
# size (-r %d,%d and -s %d,%d options).
#
# To visually compare N `totals' graphs, do
# slabinfo-gnuplot.sh -t FILE1-totals FILE2-totals ... FILEN-totals
#
min_slab_name_size=11
xmin=0
xmax=0
width=1500
height=700
mode=preprocess
usage()
{
echo "Usage: [-s W,H] [-r MIN,MAX] [-t|-l] FILE1 [FILE2 ..]"
echo "FILEs must contain 'slabinfo -X' samples"
echo "-t - plot totals for FILE(s)"
echo "-l - plot slabs stats for FILE(s)"
echo "-s %d,%d - set image width and height"
echo "-r %d,%d - use data samples from a given range"
}
check_file_exist()
{
if [ ! -f "$1" ]; then
echo "File '$1' does not exist"
exit 1
fi
}
do_slabs_plotting()
{
local file=$1
local out_file
local range="every ::$xmin"
local xtic=""
local xtic_rotate="norotate"
local lines=2000000
local wc_lines
check_file_exist "$file"
out_file=`basename "$file"`
if [ $xmax -ne 0 ]; then
range="$range::$xmax"
lines=$((xmax-xmin))
fi
wc_lines=`cat "$file" | wc -l`
if [ $? -ne 0 ] || [ "$wc_lines" -eq 0 ] ; then
wc_lines=$lines
fi
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.