- 4.1 Chapter Objectives
- 4.2 Tools That Report System Configuration
- 4.3 Tools That Report Current System Status
- 4.4 Process- and Processor-Specific Tools
- 4.5 Information about Applications
4.2 Tools That Report System Configuration
4.2.1 Introduction
This section covers tools that report static information about the system, such as the type of processor installed and so forth.
4.2.2 Reporting General System Information (prtdiag, prtconf, prtpicl, prtfru)
prtdiag is a purely informational tool that prints the machine's diagnostic details. The exact output depends on the system. I included it in this chapter because it can be a source of useful information about the setup of the machine. It is located in /usr/sbin. The tool is often the first place to look for information on the processors and memory that are installed in the system, as well as general system configuration.
Output from prtdiag on a two-CPU UltraSPARC IIICu system is shown in Example 4.1. The output identifies the processors and the system clock speed, together with the amount of memory installed and in which memory slots it is installed. The output refers to the UltraSPARC IIICu processor as the UltraSPARC III+, and further abbreviates this to US-3+.
Example 4.1. Sample Output from prtdiag
$ /usr/sbin/prtdiag System Configuration: Sun Microsystems sun4u SUNW,Sun-Blade-1000 (2xUltraSPARC III+) System clock frequency: 150 MHZ Memory size: 2GB ============================== CPUs =================================== E$ CPU CPU Temperature CPU Freq Size Impl. Mask Die Ambient --- -------- ---------- ------ ---- -------- -------- 0 900 MHz 8MB US-III+ 2.2 75 C 25 C 1 900 MHz 8MB US-III+ 2.2 75 C 24 C =============================== IO Devices ============================ Bus Freq Brd Type MHz Slot Name Model --- ---- ---- ---- -------------------------------- -------------- 0 pci 33 1 SUNW,m64B (display) SUNW,370-4362 0 pci 66 4 SUNW,qlc-pci1077,2200.5 (scsi-fc+ 0 pci 33 5 ebus/parallel-ns87317-ecpp (para+ 0 pci 33 5 ebus/serial-sab82532 (serial) 0 pci 33 5 network-pci108e,1101.1 (network) SUNW,pci-eri 0 pci 33 5 firewire-pci108e,1102.1001 (fire+ 0 pci 33 6 scsi-pci1000,f.37 (scsi-2) 0 pci 33 6 scsi-pci1000,f.37 (scsi-2) ======================= Memory Configuration ========================== Segment Table: ----------------------------------------------------------------------- Base Address Size Interleave Factor Contains ----------------------------------------------------------------------- 0x0 2GB 4 BankIDs 0,1,2,3 Bank Table: ----------------------------------------------------------- Physical Location ID ControllerID GroupID Size Interleave Way ----------------------------------------------------------- 0 0 0 512MB 0 1 0 1 512MB 1 2 0 0 512MB 2 3 0 1 512MB 3 Memory Module Groups: -------------------------------------------------- ControllerID GroupID Labels -------------------------------------------------- 0 0 J0100,J0202,J0304,J0406 0 1 J0101,J0203,J0305,J0407
Other tools exist that provide system information at various levels of detail. The tools prtconf, prtpicl, and prtfru produce long lists of system configuration information, the contents of which depend on the details available on the particular platform.
4.2.3 Enabling Virtual Processors (psrinfo and psradm)
psrinfo is a tool that will report whether the virtual processors are enabled. Sample output from psrinfo, run on a system with two 900MHz processors, is shown in Example 4.2. You can obtain more detailed output using psrinfo -v.
Example 4.2. Sample Output from psrinfo and psrinfo -v
$ psrinfo 0 on-line since 11/20/2003 11:18:59 1 on-line since 11/20/2003 11:19:00 $ psrinfo -v Status of virtual processor 0 as of: 10/23/2006 21:47:30 on-line since 11/20/2003 11:19:00. The sparcv9 processor operates at 900 MHz, and has a sparcv9 floating-point processor. Status of virtual processor 1 as of: 10/23/2006 21:47:30 on-line since 11/20/2003 11:19:00. The sparcv9 processor operates at 900 MHz, and has a sparcv9 floating-point processor.
Solaris 10 introduced the -p option to psrinfo that reports on the physical processors in the system. Example 4.3 shows the output from a system that has a single UltraSPARC T1 physical processor with 32 virtual processors.
Example 4.3. Output from psrinfo -pv from an UltraSPARC T1 System
$ psrinfo -pv The physical processor has 32 virtual processors (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31) UltraSPARC T1 (cpuid 0 clock 1200 MHz)
You can enable or disable the virtual processors using the psradm tool. The -f flag will disable a processor and the -n flag will enable it. This tool is available only with superuser permissions.
The -i flag for psradm excludes CPUs from handling interrupts; this may be of use when partitioning the workload over multiple CPUs. Example 4.4 shows the command for excluding CPU number 1 from the CPUs that are available to handle interrupts.
Example 4.4. Excluding a CPU from Interrupt Handling
$ psradm -i 1 $
4.2.4 Controlling the Use of Processors through Processor Sets or Binding (psrset and pbind)
It is possible to configure systems so that the processors are kept in discrete sets. This will partition compute resources so that particular applications run on particular sets of processors. The command to do this is psrset, and it is available only with superuser permissions. Example 4.5 illustrates the use of processor sets.
Example 4.5. Example of the psrset Command
# psrset -c 1 created processor set 1 processor 1: was not assigned, now 1 # psrset user processor set 1: processor 1 # psrset -e 1 sleep 1 # psrset -d 1 removed processor set 1
The code in Example 4.5 first shows the creation of a processor set using the psrset -c option, which takes a list of processor IDs and binds those processors into a set. The command returns the id of the set that has just been created. The command psrset with no options reports the processor sets that are currently in existence, and the processors that belong to those sets. It is possible to run a particular process on a given set using the psrset -e option, which takes both the processor set to use and the command to execute on that set. Finally, the psrset -d option deletes the processor set that is specified.
You must be careful when using processor sets (or any partitioning of the processor resources). Using processor sets, it is possible to introduce load imbalance, in which a set of processors is oversubscribed while another set is idle. You need to consider the allocation of processors to sets at the level of the entire machine, which is why the command requires superuser privileges.
It is a good practice to check for both the number of enabled virtual processors (using psrinfo) and the existence of processor sets whenever the system's performance is being investigated. On systems where processor sets are used regularly, or processors are often switched off, they can be a common reason for the system not providing the expected performance.
It is also possible to bind a single process to a particular processor using the pbind command, which takes the -b flag together with the pid and the processor ID as inputs when binding a process to a processor, and the -u flag together with the pid to unbind the process. Unlike processor sets that exclude other processes from running on a given group of processors, processor binding ensures that a particular process will run on a particular processor, but it does not ensure that other processes will not also run there.
4.2.5 Reporting Instruction Sets Supported by Hardware (isalist)
isalist is a Solaris tool that outputs the instruction sets architectures (ISAs) the processor supports. This can be useful for picking the appropriate compiler options (this will be covered in Section 5.6.5 of Chapter 5). It is also useful in determining the particular variant of CPU that the system contains. Example 4.6 shows output from the isalist command on an UltraSPARC III-based system. It shows that there is a SPARC processor in the system, and that this can handle SPARC V7, V8, and V9 binaries. The processor can also handle the VIS 2.0 instruction set extensions.
Example 4.6. Sample Output from the isalist Command
$ isalist sparcv9+vis2 sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
4.2.6 Reporting TLB Page Sizes Supported by Hardware (pagesize)
In Section 1.9.2 of Chapter 1 we discussed the Translation Lookaside Buffer (TLB), which the processor uses to map virtual memory addresses to physical memory addesses. Different processors are able to support different page sizes. The advantage of larger page sizes is that they let the TLB map more physical memory using a fixed number of TLB entries. For example, a TLB with 64 entries can map 8KB*64=512KB when each entry is an 8KB page, but can map 4MB*64=256MB when each entry holds a 4MB page. The number of different page sizes that can be supported simultaneously is hardware-dependent. Even if the hardware supports large page sizes, there is no guarantee that an application will recieve large pages if it requests them. The number of available large pages depends on the amount of memory in the system and the degree to which contiguous memory is available.
The pagesize command prints out the different TLB page sizes that the processor can support. If no flags are specified, the utility will print the default page size. If the flag -a is used, it will report all the available page sizes (see Example 4.7).
Example 4.7. Sample Output from the pagesize Command
$ pagesize -a 8192 65536 524288 4194304
The pmap command (covered in Section 4.4.7) reports the page sizes that an application has been allocated.
It is possible to change the page sizes that an application requests. You can do this in several ways.
- At compile time, you can use the -xpagesize compiler flag documented in Section 5.8.6 of Chapter 5.
- You can preload the Multiple PageSize Selection (mpss.so.1) library, which uses environment variables to set the page sizes. We will cover preloading in more detail in Section 7.2.10 of Chapter 7. An example of using preloading to set the page size for an application appears in Example 4.8. In this example, the environment is being set up to request 4MB pages for both the application stack and the heap.
Example 4.8. Using mpss.so.1 to Set the Page Size for an Application
$ setenv MPSSHEAP 4M $ setenv MPSSSTACK 4M $ setenv LD_PRELOAD mpss.so.1 $ a.out
- You can set the preferred page size for a command or for an already running application through the ppgsz utility. This utility takes a set of page sizes plus either a command to be run with those page sizes, or a pid for those page sizes to be applied to. Example 4.9 shows examples of using the ppgsz command.
Example 4.9. Using the ppgsz Command
% ppgsz -o heap=4M a.out % ppgsz -o heap=64K -p <pid>
Table 4.1 shows the supported page sizes for various processors.
Table 4.1. Page Sizes Supported by Various Processor Types
Processor |
4KB |
8KB |
64KB |
512KB |
2MB |
4MB |
32MB |
256MB |
UltraSPARC IIICu |
||||||||
UltraSPARC IV |
||||||||
UltraSPARC IV+ |
||||||||
UltraSPARC T1 |
||||||||
UltraSPARC T2 |
||||||||
SPARC64 VI |
||||||||
x64 |
4.2.7 Reporting a Summary of SPARC Hardware Characteristics (fpversion)
fpversion is a tool that ships with the SPARC compiler and is not available on x86 architectures. The tool will output a summary of the processor's capabilities. The most important part of the output from fpversion is that it displays the options the compiler will use when it is told to optimize for the native platform (see -xtarget=native in Section 5.6.4 of Chapter 5).
Example 4.10 shows output from fpversion from an UltraSPARC IIICu-based system.
Example 4.10. Output from fpversion on an UltraSPARC IIICu Based System
$ fpversion A SPARC-based CPU is available. Kernel says CPU's clock rate is 1050.0 MHz. Kernel says main memory's clock rate is 150.0 MHz. Sun-4 floating-point controller version 0 found. An UltraSPARC chip is available. Use "-xtarget=ultra3cu -xcache=64/32/4:8192/512/2" code-generation option. Hostid = 0x83xxxxxx.