Detecting alignment exceptions with the alstat tool
Misalignment of data can cause the hardware to generate an alignment exception.
AIX compilers perform natural alignment of data types. For example, data of type short, which is 2 bytes long, is padded automatically to 4 bytes by the compiler. Common programming practices such as typecasting and usage of alignment pragmas can cause application data to be aligned incorrectly. POWER processor-based optimization assumes correct alignment of data. Thus, fetching misaligned data may require multiple memory accesses where a single access should have sufficed. An alignment exception generated by a misalignment of data would force the kernel to simulate the needed memory accesses. As with the case of instruction emulation, this can degrade application performance.
The alstat tool packaged with bos.perf.tools can be used to detect if alignment exceptions are occurring. To show alignment exceptions on a per-CPU basis, use the -v option.
Because alstat and emstat are the same binary, either of these tools can be used to show instruction emulation and alignment exceptions. To show instruction emulation, use the -e option on alstat. To show alignment exceptions, use the -a option on emstat.
# alstat -e 1
Alignment Alignment Emulation Emulation
SinceBoot Delta SinceBoot Delta
0 0 0 0
0 0 0 0
0 0 0 0