| Area |
Source Code |
AIX 5.3 Binary |
Comments |
| Adapters |
adapt.c |
adapt |
This program outputs the adapters stats (actually the added up disk stats as tapes are not included). This explains why the busy percentage can go over 100%. It shows the actual counters and the fact you have to take the differences between data snapshots to workout what happened in the last interval. |
| Disks |
disks_simple.c |
disks_simple |
This program outputs the disk stats for all disks. It will work with early version of libperfstat on AIX 5.1 onwards. It outputs the disk names, descriptions, volume group, block size. Then once a second the disknames, disk size and disk free in MB, transfers, read and write blocks, time busy percent and Qdepth. |
| Disks |
disks_service.c |
disks_service |
This program outputs the disk stats for all disks. It includes the new in AIX 5.3 service times details that should allow queueing theory analyses. The output is modelled on the iostat -D output from higher Maintenance Levels of AIX 5.3 - I compiled it on ML04 |
| Disk Paths |
diskpath.c |
diskpath |
This program outputs the disk path stats for each disk in turn. This should allow the study of multipath I/O and vpaths but currently only documents the LAST PATH |
| Disk Totals |
disktot.c |
disktot |
This program outputs the disk stats for all disks as a total. |
| Memory |
memory.c |
memory |
This program outputs the memory stats (real and virtual) from libperfstat and the perfstat_memory_total() function |
| Memory |
memory_vminfo.c |
memory_vminfo |
This program outputs the memory stats from the vminfo structure and the vmgetinfo() function |
| Network |
net.c |
net |
This program outputs the Network stats for each network. This one just shows the counters . This will demonstrate the counters - altough the libperfstat I/F claims 64 but the numbers will over flow at unsigned 32 bit. With a 10 Gbit Network card going full speed this takes on 4 seconds!! |
| Network Totals |
nettot.c |
nettot |
This program outputs the Network stats overall for the machine. |
| NFS |
nfs.c |
nfs |
This program outputs the NFS stats. This Interface is complex due to all the protocols but this worked example can help you out by showing how to get the basic information out. |
| CPU |
cpu.c |
cpu |
This program outputs the CPU stats and details for each online CPU including system calls, read, write, fork, exec and character I/O. It can help you check that the workload it evenly spread across CPUs and is multi-threaded |
| CPU totals |
cpus.c |
cpus |
This program outputs details about your hardware and the CPU stats for the machine and is a "faked up" vmstat with physical CPU stats too. You need to run this on a shared processor LPAR to see the fully details of the difference between physical, virtual processors. |
| LPAR |
lpar.c |
lpar |
This program outputs the logical partition stats. This is all you can find out about your logical partition (LPAR) in full gory detail from the lpar_get_info() system call. The names are inconsistent, the units are often weird (and not documented), some fields are unexplained and some are truely massive numbers like tot_dispatch_time. |
| Perf |
perf.c |
perf |
This program is a prototype nmon and shows the use of curses and outputs CPU information. |
| Processes |
getprocs64.c |
getprocs64 |
This program shows how to start writing the "ps" command. It gets the procentry64 structure for each process and outputs PID, Parent PID, CPU time, Resident Text and Data sizes, threads, maximum open files, WLM classname and command name. Unfortunately, to get the CPU time per process you need to capture the processes stats twice and take the difference on the CPU counters (pi_ru.ru_utime and ru_stime). This is made difficult as some processes may have started or finished so you have to match the two procentry64 structure arrays by PID and then may be reorder them too so you list this in CPU use order! Also note that on some machines the processes are NOT returned in PID order. |
| Worms |
worms.c |
worms_aix
worms_lop |
This program is very different. It is an implimentation of the classic UNIX kernel testing program from 20 years ago. It outputs wiggly worms via curses on the screen. This was a good test of interrupt handling, terminal output and the Kernel. So what is the point? Now the program is used to demonstrate Dynamic LPAR changes i.e Entitlement changes of Capped LPAR and/or Uncapping the LPAR. As it is single threaded it can't spread across more then one CPU so VP changes do not effect it. Note: this version had to be slowed down by a factor of 1 million to work on POWER5 - the CPUs are a lot faster these days. It takes a single argument, the number of worms (maximum is 50). Use control-C to end the program. The number at the top left is the number of loops per second is is managing to do. worms_aix is for AIX 5L and worms_lop is for Linux on POWER (compiled under SUSE SLES9). If you rewrite it for multi-threading, please send in the source code. |
| Filesystems |
filesystems.c |
filesystems |
This is a simple df command clone and lists the filesystems - it does not use libperfstat just regular system calls. |
| Dedicated Donating |
donate.c |
donate |
This program outputs the Dedicated CPU LPAR with Donating activated statistics. This needs to be compiled on a system the its libperfstat includes the donating stats in perfstat_partition_t data structure. It outputs the logical and physical percentages, physical CPU Used and then the donating stats so you get the whole picture. I compiled it on ML04 but with the libperfstat.h header file from AIX6. August 2007. |
Nice samples, they were very useful to me.
But quite all segfaulted after compilation on my AIX 5.3 box. The reason is the cast from string to perfstat_id_t, which is a struct (with one string member).
For instance, disks.c :
perfstat_disk((perfstat_id_t *)FIRST_DISK, ...) => segfault
Correction :
perfstat_id_t id;
strcpy(id.name, FIRST_DISK);
perfstat_disk(id, ...) => works