__stat built-in variable
This built-in variable provides access to the system statistics for various AIX® kernel components by using the Vue script. The system statistic are provided as running counters that can be accessed from any probe point of any ProbeVue script. A new probe point is not added to support the system statistics. To access system statistics, you must have aix.ras.probevue.trace kernel tracing privileges.
System statistics are useful for the following reasons:
- Statistics can be accessed without turning on a system trace or a component trace.
- Only required fields can be displayed. This is not possible by using the current statistics commands. You can avoid copying a large amount of data by accessing fields directly from the kernel structures.
- The system statistics is now available in the Vue scripts to easily complete the arithmetic logical operation. For example, you can use ProbeVue to add the number of operations across two disks.
The Vue built-in __stat variable
allows statistics to be retrieved both at the global level and the individual component level. Data
is provided as running counters and Vue scripts require
access to the counters periodically. You can save the values that you need, and compute delta values
to get the required results. You can access system statistics for the following reasons:
- To write a simple statistic tool by using the Vue
script without calling the C/C++ API to print out the delta value for the counters every second or
at an interval that is requested by the user.
- To monitor counter value in case if the delta value exceeds threshold. When the value exceeds the threshold, a script logs the message.
- To use the Vue script to log a message when the actual value of the counter, which is not a delta value, exceeds the threshold value (for example, the maximum service time of a disk).
There are different modes that are provided by the built in __stat variable
to access statistics from the source. The source of the system statistic is obtained from different
system components. The statistics access modes follow.
- Synchronous mode access
- ProbeVue provides a direct access to the system statistics when the Vue script is run. This type of direct access is a live data access. By default, ProbeVue selects a live data access, if it is available. Every statistic might not be accessed in this mode because components do not provide the direct access or direct access is not possible in the current thread.
- Asynchronous or Cached mode
- Data is periodically gathered from source and cached in the ProbeVue. The Vue script uses a cache to access the data. A cache refresh interval is tuned at the single session or at all session level. Every source component provides a method to access statistics in asynchronous mode. In such cases, you can provide access to all statistics in cached mode by using the fetch_stats_async_only tunable. Cached mode is used when you cannot live data or you want to monitor the system where live data is not required.
Examples
- The following example prints the number of I/O transfers for a disk named
hdisk9
every second:@@interval:*:clock:1000 { printf("Number of transfers = %lld\n", __stat.io.disk.hdisk9->transfers); }
- The following example displays the units of service time is
microseconds:
@@syscall:*:read:exit { rdservtime = __stat.io.disk.hdisk10->rd_service_time; printf(“rdservtime=%lld microseconds\n”, rdservtime); }
__stat built-in syntax
The general syntax for using the __stat built-in expressions is as follows:
__stat.<level1_keyword>[.<level2_keyword>.....][.<inst1_keyword>....]-><fieldname>
Pre-defined levels and instances for the Storage IO Statistics are shown in the following
table:
Pre-defined levels and instances for the Network Statistics are shown in the
following table:
Built-in | Level 0 | Level 1 | Level 2 | Instance 0 | Fields Names |
---|---|---|---|---|---|
__stat | net | adapter | ent[0...n] |
|
|
__stat | net | interface | en[0....n] |
|
|
__stat | net | protocol | ip |
|
|
__stat | net | protocol | ipv6 |
|
|
__stat | net | protocol | tcp |
|
|
__stat | net | protocol | udp |
|
|
__stat | net | protocol | icmp |
|
|
__stat | net | protocol | icmpv6 |
|
|
__stat | net | protocol | igmp |
|
|
__stat | net | protocol | arp |
|