[PATCH v2] pmap: new applet

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 30 01:37:49 UTC 2010


On Tuesday 27 July 2010 15:33, Bernhard Reutner-Fischer wrote:
> Hi,
> 
> On Tue, Jul 27, 2010 at 03:25:15PM +0300, Alexander Shishkin wrote:
> >pmap is a tool used to look at processes' memory maps, normally found
> >in procps package. It provides more readable and easily sortable output
> >(one line per mapping) from  maps/smaps files in /proc/PID/.  This would
> >help in debugging memory usage issues, especially on devices where lots
> >of typing is not a viable option.
> >
> >This patch does'n implement -d and -A command line options of GNU pmap,
> >since those are not that must have features and I was afraid of going
> >blind from looking at its code.
> >
> >The implementation takes smaps scanning part out of procps_scan() function
> >and moves it into procps_read_smaps(), which does more detailed processing
> >of a single PID's smaps data.

Thanks! Can you combine most things (apart from libbb changes) into one file?

Look at procps/mpstat.c for an example, see "magic comments":

//applet:IF_MPSTAT(APPLET(mpstat, _BB_DIR_BIN, _BB_SUID_DROP))

//kbuild:lib-$(CONFIG_MPSTAT) += mpstat.o

//config:config MPSTAT
//config:       bool "mpstat"
//config:       default y
//config:       help
//config:         Per-processor statistics
...
//usage:#define mpstat_trivial_usage
//usage:       "[-A] [-I SUM|CPU|ALL|SCPU] [-u] [-P num|ALL] [INTERVAL [COUNT]]"
//usage:#define mpstat_full_usage "\n\n"
//usage:       "Per-processor statistics\n"
...

-- 
vda


More information about the busybox mailing list