以 PDF 格式下載這本書 (9905 KB)
trapstat(1M)Name | Synopsis | Description | Options | Examples | Attributes | See Also | Notes Name
Synopsis
/usr/sbin/trapstat [-t | -T | -e entry]
[-C processor_set_id | -c cpulist] [-P] [-a]
[-r rate] [ [interval [count]] | command | [args]]
/usr/sbin/trapstat -l DescriptionThe trapstat utility gathers and displays run-time trap statistics on UltraSPARC-based systems. The default output is a table of trap types and CPU IDs, with each row of the table denoting a trap type and each column of the table denoting a CPU. If standard output is a terminal, the table contains as many columns of data as can fit within the terminal width; if standard output is not a terminal, the table contains at most six columns of data. By default, data is gathered and and displayed for all CPUs; if the data cannot fit in a single table, it is printed across multiple tables. The set of CPUs for which data is gathered and displayed can be optionally specified with the -c or -C option. Unless the -r option or the -a option is specified, the value displayed in each entry of the table corresponds to the number of traps per second. If the -r option is specified, the value corresponds to the number of traps over the interval implied by the specified sampling rate; if the -a option is specified, the value corresponds to the accumulated number of traps since the invocation of trapstat. By default, trapstat displays data once per second, and runs indefinitely; both of these behaviors can be optionally controlled with the interval and count parameters, respectively. The interval is specified in seconds; the count indicates the number of intervals to be executed before exiting. Alternatively, command can be specified, in which case trapstat executes the provided command and continues to run until the command exits. A positive integer is assumed to be an interval; if the desired command cannot be distinguished from an integer, the full path of command must be specified. UltraSPARC I (obsolete), II, and III handle translation lookaside buffer (TLB) misses by trapping to the operating system. TLB miss traps can be a significant component of overall system performance for some workloads; the -t option provides in-depth information on these traps. When run with this option, trapstat displays both the rate of TLB miss traps and the percentage of time spent processing those traps. Additionally, TLB misses that hit in the translation storage buffer (TSB) are differentiated from TLB misses that further miss in the TSB. (The TSB is a software structure used as a translation entry cache to allow the TLB to be quickly filled; it is discussed in detail in the UltraSPARC II User's Manual.) The TLB and TSB miss information is further broken down into user- and kernel-mode misses. Workloads with working sets that exceed the TLB reach may spend a significant amount of time missing in the TLB. To accommodate such workloads, the operating system supports multiple page sizes: larger page sizes increase the effective TLB reach and thereby reduce the number of TLB misses. To provide insight into the relationship between page size and TLB miss rate, trapstat optionally provides in-depth TLB miss information broken down by page size using the -T option. The information provided by the -T option is a superset of that provided by the -t option; only one of -t and -T can be specified. Options
The following options are supported: ExamplesExample 1 Using trapstat Without OptionsWhen run without options, trapstat displays a table of trap types and CPUs. At most six columns can fit in the default terminal width; if (as in this example) there are more than six CPUs, multiple tables are displayed:
Example 2 Using trapset with CPU FilteringThe -c option can be used to limit the CPUs on which trapstat is enabled. This example limits CPU 1 and CPUs 12 through 15.
Example 3 Using trapstat with TLB StatisticsThe -t option displays in-depth TLB statistics, including the amount of time spent performing TLB miss processing. The following example shows that the machine is spending 14.1 percent of its time just handling D-TLB misses:
Example 4 Using trapstat with TLB Statistics and Page Size InformationBy specifying the -T option, trapstat shows TLB misses broken down by page size. In this example, CPU 0 is spending 7.9 percent of its time handling user-mode TLB misses on 8K pages, and another 2.3 percent of its time handling user-mode TLB misses on 64K pages.
Example 5 Using trapstat with Entry FilteringBy specifying the -e option, trapstat displays statistics for only specific trap types. Using this option minimizes the probe effect when seeking specific data. This example yields statistics for only the dtlb-prot and syscall-32 traps on CPUs 12 through 15:
Example 6 Using trapstat with a Higher Sampling RateThe following example uses the -r option to specify a sampling rate of 1000 samples per second, and filter only for the level-10 trap. Additionally, specifying the -P option yields parsable output. Notice the timestamp difference between the level-10 events: 9,998,000 nanoseconds and 10,007,000 nanoseconds. These level-10 events correspond to the system clock, which by default ticks at 100 hertz (that is, every 10,000,000 nanoseconds).
AttributesSee attributes(5) for descriptions of the following attributes:
See Alsolockstat(1M), pmap(1), psrset(1M), psrinfo(1M), pbind(1M), ppgsz(1), getpagesizes(3C) Sun Microelectronics UltraSPARC II User's Manual, January 1997, STP1031, The SPARC Architecture Manual, Version 9, 1994, Prentice-Hall. NotesWhen enabled, trapstat induces a varying probe effect, depending on the type of information collected. While the precise probe effect depends upon the specifics of the hardware, the following table can be used as a rough guide:
These probe effects are per trap not for the system as a whole. For example, running trapstat with the default options on a system that spends 7% of total time handling traps induces a performance degradation of less than one half of one percent; running trapstat with the -t or -T option on a system spending 5% of total time processing TLB misses induce a performance degradation of no more than 2.5%. When run with the -t or -T option, trapstat accounts for its probe effect when calculating the %tim fields. This assures that the %tim fields are a reasonably accurate indicator of the time a given workload is spending handling TLB misses — regardless of the perturbing presence of trapstat. While the %tim fields include the explicit cost of executing the TLB miss handler, they do not include the implicit costs of TLB miss traps (for example, pipeline effects, cache pollution, etc). These implicit costs become more significant as the trap rate grows; if high %tim values are reported (greater than 50%), you can accurately infer that much of the balance of time is being spent on the implicit costs of the TLB miss traps. Due to the potential system wide degradation induced, only the super-user can run trapstat. Due to the limitation of the underlying statistics gathering methodology, only one instance of trapstat can run at a time. Name | Synopsis | Description | Options | Examples | Attributes | See Also | Notes |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||