sprofil.2 (2010 09)

s
sprofil(2) sprofil(2)
specified by the pr_base field is incremented, unless that would result in overflow.
Each call to
sprofil() disables profiling if it was enabled and then enables profiling of the regions
specified by the prof array entries.
Due to variations in instruction length on different architectures, the pr_scale setting results in different
entry-to-instruction ratios. The following tables show the number of instructions that map into each ele-
ment of the array that pr_base points to based on instruction size, pr_scale and flags.
On PA-RISC machines, instructions are 4 bytes each.
Scale PROF_USHORT PROF_UINT PROF_UINT64
2 16384 32768 65536
4 8192 16384 32768
8 4096 8192 16384
16 2048 4096 8192
32 1024 2048 4096
64 512 1024 2048
128 256 512 1024
256 128 256 512
512 64 128 256
1024 32 64 128
2048 16 32 64
4096 8 16 32
8192 4 8 16
16384 2 4 8
32768 1 2 4
65536 0.5 1 2
131072 0.25 0.5 1
On Itanium-based machines, pc points to a 16-byte bundle containing three instructions. It is not possible
to profile individual instructions.
Scale PROF_USHORT PROF_UINT PROF_UINT64
2 4096 8192 16384
4 2048 4096 8192
8 1024 2048 4096
16 512 1024 2048
32 256 512 1024
64 128 256 512
128 64 128 256
256 32 64 128
512 16 32 64
1024 8 16 32
2048 4 8 16
4096 2 4 8
8192 1 2 4
16384 0.5 1 2
32768 0.25 0.5 1
Note that a 1-1 mapping of PROF_UINT counters consumes twice as much space as for PROF_USHORT
counters, and should only be used in those cases where you expect a 16-bit counter to overflow. Likewise,
a 1-1 mapping of PROF_UINT64 counters consumes twice as much space as for PROF_UINT counters,
and should only be used in those cases where you expect a 32-bit counter to overflow.
The results of specifying a pr_scale that corresponds to an instruction-to-profiling element ratio smaller
than 1-1 mapping produces undefined behavior.
If overlapping text regions are specified, then the pr_base associated with the largest offset less than the
value of the program counter (
pc) gets incremented. If more than one text region has the same offset, the
first one is chosen.
A text region with the pr_offset of 0 and pr_scale of 0x0002 acts as an overflow bin. Any
pc value not
previously matched or outside the regions of text space specified is considered to match this text region
and the first counter of the specified pr_base is incremented. If specified, such an overflow bin should
always be last in the list of specified regions.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010