1 PMADVISE(1)                      User Commands                     PMADVISE(1)
   2 
   3 
   4 
   5 NAME
   6        pmadvise - applies advice about memory to a process
   7 
   8 SYNOPSIS
   9        pmadvise -o option[,option] [-F] [-l] [-v] pid...
  10 
  11 
  12 DESCRIPTION
  13        pmadvise applies advice about how memory is used in the specified
  14        process using madvise(3C).
  15 
  16 
  17        pmadvise allows users to apply advice to a specific sub-range at a
  18        specific instant in time. pmadvise differs from madv.so.1(1) in that
  19        madv.so.1(1) applies the advice throughout execution of the target
  20        program to all segments of a specified type.
  21 
  22 OPTIONS
  23        The following options are supported:
  24 
  25        -F
  26              Force by grabbing the target process even if another process has
  27              control.
  28 
  29              You should exercise caution when using the -F option. See
  30              proc(1).
  31 
  32 
  33        -l
  34              Show unresolved dynamic linker map names.
  35 
  36 
  37        -o
  38              Specify advice to apply in the following form:
  39 
  40                private=advice
  41                shared=advice
  42                heap=advice
  43                stack=advice
  44                address[:length]=advice
  45 
  46 
  47              where the advice can be one of the following:
  48 
  49                normal
  50                random
  51                sequential
  52                willneed
  53                dontneed
  54                free
  55                access_lwp
  56                access_many
  57                access_default
  58                purge
  59 
  60 
  61              An address and length can be given to specify a subrange to apply
  62              the advice.The address should be hexadecimal and the length
  63              should be in bytes by default.
  64 
  65              If length is not specified and the starting address refers to the
  66              start of a segment, the advice is applied to that segment. length
  67              can be qualified by K, M, G, T, P, or E to specify kilobytes,
  68              megabytes, gigabytes, terabytes, or exabytes respectively as the
  69              unit of measure.
  70 
  71 
  72        -v
  73              Print verbose output. Display output as pmap(1) does, showing
  74              what advice is being applied where. This can be useful when the
  75              advice is being applied to a named region (for example, private,
  76              shared, and so forth) to get feedback on exactly where the advice
  77              is being applied.
  78 
  79 
  80 
  81        pmadvise tries to process all legal options. If an illegal address
  82        range is specified, an error message is printed and the offending
  83        option is skipped.  pmadvise quits without processing any options and
  84        prints a usage message when there is a syntax error.
  85 
  86 
  87        If conflicting advice is given on a region, the order of precedence is
  88        from most specific advice to least, that is, most general. In other
  89        words, advice specified for a particular address range takes precedence
  90        over advice for heap and stack which in turn takes precedence over
  91        advice for private and shared memory.
  92 
  93 
  94        Moreover, the advice in each of the following groups are mutually
  95        exclusive from the other advice within the same group:
  96 
  97          MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL
  98          MADV_WILLNEED, MADV_DONTNEED, MADV_FREE, MADV_PURGE
  99          MADV_ACCESS_DEFAULT, MADV_ACCESS_LWP, MADV_ACCESS_MANY
 100 
 101 
 102 
 103 OPERANDS
 104        The following operands are supported:
 105 
 106        pid
 107               Process ID.
 108 
 109 
 110 EXAMPLES
 111        Example 1 Applying Advice to a Segment at Specified Address
 112 
 113 
 114        The following example applies advice to a segment at a specified
 115        address:
 116 
 117 
 118          % pmap $$
 119          100666: tcsh
 120          00010000     312K r-x--  /usr/bin/tcsh
 121          0006C000      48K rwx--  /usr/bin/tcsh
 122          00078000     536K rwx--    [ heap ]
 123          FF100000     856K r-x--  /lib/libc.so.1
 124          FF1E6000      32K rwx--  /lib/libc.so.1
 125          FF1EE000       8K rwx--  /lib/libc.so.1
 126          FF230000     168K r-x--  /lib/libcurses.so.1
 127          FF26A000      32K rwx--  /lib/libcurses.so.1
 128          FF272000       8K rwx--  /lib/libcurses.so.1
 129          FF280000     576K r-x--  /lib/libnsl.so.1
 130          FF310000      40K rwx--  /lib/libnsl.so.1
 131          FF31A000      24K rwx--  /lib/libnsl.so.1
 132          FF364000       8K rwxs-    [ anon ]
 133          FF370000      48K r-x--  /lib/libsocket.so.1
 134          FF38C000       8K rwx--  /lib/libsocket.so.1
 135          FF3A0000       8K r-x--  /platform/sun4u-us3/lib/libc_psr.so.1
 136          FF3B0000     176K r-x--  /lib/ld.so.1
 137          FF3EC000       8K rwx--  /lib/ld.so.1
 138          FF3EE000       8K rwx--  /lib/ld.so.1
 139          FFBE6000     104K rw---    [ stack ]
 140          %
 141          % pmadvise -o 78000=access_lwp $$
 142 
 143          %
 144 
 145 
 146 
 147        Example 2 Using the -v Option
 148 
 149 
 150        The following example displays verbose output from pmadvise:
 151 
 152 
 153 
 154          % pmadvise -o heap=access_lwp,stack=access_default -v $$
 155          1720:   -sh
 156          00010000      88K r-x--  /sbin/sh
 157          00036000       8K rwx--  /sbin/sh
 158          00038000      16K rwx--    [ heap ]           <= access_lwp
 159          FF250000      24K r-x--  /lib/libgen.so.1
 160          FF266000       8K rwx--  /lib/libgen.so.1
 161          FF272000       8K rwxs-    [ anon ]
 162          FF280000     840K r-x--  /lib/libc.so.1
 163          FF362000      32K rwx--  /lib/libc.so.1
 164          FF36A000      16K rwx--  /lib/libc.so.1
 165          FF380000       8K r-x--  /platform/sun4u-us3/lib/libc_psr.so.1
 166          FF390000      64K rwx--    [ anon ]
 167          FF3B0000     168K r-x--  /lib/ld.so.1
 168          FF3EA000       8K rwx--  /lib/ld.so.1
 169          FF3EC000       8K rwx--  /lib/ld.so.1
 170          FFBFE000       8K rw---    [ stack ]          <= access_default
 171 
 172 
 173 
 174 EXIT STATUS
 175        The following exit values are returned:
 176 
 177        0
 178                    Successful completion.
 179 
 180 
 181        non-zero
 182                    An error occurred.
 183 
 184 
 185 FILES
 186        /proc/*
 187                           Process files
 188 
 189 
 190        /usr/prob/lib/*
 191                           proc tools support files
 192 
 193 
 194 ATTRIBUTES
 195        See attributes(5) for descriptions of the following attributes:
 196 
 197 
 198 
 199 
 200        +--------------------+-----------------+
 201        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 202        +--------------------+-----------------+
 203        |Interface Stability | See below.      |
 204        +--------------------+-----------------+
 205 
 206 
 207        The command syntax is Evolving. The output formats are Unstable.
 208 
 209 SEE ALSO
 210        madv.so.1(1), pmap(1), proc(1), madvise(3C), attributes(5)
 211 
 212 
 213 
 214                               September 25, 2008                   PMADVISE(1)