Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

pmadvise(1)

名称

pmadvise - 将关于内存的建议应用于某个进程

用法概要

pmadvise [-Flv] [-o option[,option]
    [--scale[=item1,item2,...]] pid...

描述

pmadvise 使用 madvise(3C) 在指定的进程中应用有关如何使用内存的建议。

pmadvise 允许用户在一个特定时刻向一个子范围应用建议。pmadvisemadv.so.1(1) 的区别在于,madv.so.1(1) 在目标程序的整个执行过程中将建议应用于指定类型的所有段。

选项

支持以下选项:

–F

通过抓取目标进程来强制执行,即使另一进程已掌握了控制权。

您应当慎用 –F 选项。请参见 proc(1)

–h

On verbose output, memory sizes are scaled to a human readable format.The –h option is equivalent to using the –scale=max,1024 option.

–l

显示未解析的动态链接程序映射名称。

–o

以下面的格式指定要应用的建议:


private=advice
shared=advice
heap=advice
stack=advice
address[:length]=advice

其中,advice 可以是下列值之一:


normal
random
sequential
willneed
dontneed
free
access_lwp
access_many
access_many_pset
access_default

可以提供 addresslength 来指定应用建议的子范围。缺省情况下,address 应该为十六进制,并且 length 应以字节计。

If length is not specified and the starting address refers to the start of a segment, the advice is applied to that segment. length can have a fractional part, and can be qualified with a K, M, G, T, P, or E scale factor, denoting kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes respectively.

–v

Print verbose output.像 pmap(1) 一样显示输出,显示哪个建议应用于何处。当建议应用于某个指定区域(例如专用的、共享的,等等)时,要精确获取关于建议应用于何处的反馈时,这可能比较有用。

–scale[=item1,item2,...]

On verbose output, memory sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T.Scaling is done by repetitively dividing by 1024, unless otherwise specified.

–scale specified without arguments enables default scaled output, and is equivalent to –scale=max,1024.

–scale can be specified with the following arguments.

binary

Scaling is done by repetitively dividing by a scale factor of 1024.The use of binary scaling is indicated by the addition of an 'i' modifier to the suffix (Ki, Mi, Gi, ...).

max

Values are scaled to the largest unit for which the result retains a non-zero integer part.Up to 2 decimal places of fractional output may be shown.

min

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 5 columns, and displayed without the use of fractional output.

minwide

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 8 columns, and displayed without the use of fractional output.

1000

Scaling is done by repetitively dividing by a scale factor of 1000.

1024

Scaling is done by repetitively dividing by a scale factor of 1024.

–?
–-help

输出用法消息并立即退出。

pmadvise 尝试处理所有合法选项。如果指定了非法的地址范围,则会输出一条错误消息,且跳过违规选项。当存在语法错误时,pmadvise 将不处理任何选项而退出,并且会输出用法消息。

如果在某个区域上给定了冲突的建议,则优先顺序是从针对性最强的建议到针对性最弱的(即最通用的)建议。换句话说,为显式地址范围指定的建议优先于为堆和栈指定的建议,其次,为堆和栈指定的建议优先于为专用和共享内存指定的建议。

此外,下列每个组中的建议与同一组中的其他建议是互斥的:


MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL
MADV_WILLNEED, MADV_DONTNEED, MADV_FREE
MADV_ACCESS_DEFAULT, MADV_ACCESS_LWP, MADV_ACCESS_MANY

操作数

支持下列操作数:

pid

进程 ID.

示例

示例 1 将建议应用于位于指定地址的段

以下示例将建议应用于位于指定地址的段:


% pmap $$ | grep heap
00000001AEC8C000    8K rw-----  [ heap ]
%
% pmadvise -o 78000=access_lwp $$

%
示例 2 使用 –v 选项

以下示例显示了来自 pmadvise 的详细输出。为简短起见,省略了一些输出。

 
% pmadvise -o heap=access_lwp,stack=access_default -v $$
0000000100000000 1728K r-x----  [ text ] /usr/bin/sh
00000001001B0000   56K r-x----  [ text ] /usr/bin/sh
00000001002BE000    8K rwx----  [ data ] /usr/bin/sh
00000001002C0000   64K rwx----  [ data ] /usr/bin/sh
00000001002D0000   16K rwx----  [ data ] /usr/bin/sh
0000000100300000   24K rw-----  [ bss ] /usr/bin/sh
0000000EEBFC4000    8K rw-----  [ heap ]        <= access_lwp
0007FCB434C00000 2176K r-x----  [ text ] /lib/sparcv9/libc.so.1
...
0007FCB435000000  704K r-x----  [ text ] /lib/sparcv9/libm.so.2
...
0007FCB435200000  256K r-x----  [ text ] /lib/sparcv9/ld.so.1
...
0007FCB435370000  128K rw-----  [ anon ]
...
FFFFFCFCE72A0000   64K rw-----  [ stack ]       <= access_default
FFFFFCFCE72B0000   40K rw-----  [ stack ]       <= access_default

退出状态

将返回以下退出值:

0

成功完成。

非零值

出现错误。

文件

/proc/*

进程文件

/usr/prob/lib/*

proc 工具支持文件

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os
接口稳定性
请参见下文。

命令语法是 "Committed"(已确定)。输出格式是 "Uncommitted"(未确定)。

另请参见

madv.so.1(1), pmap(1), proc(1), madvise(3C), attributes(7)