perfstat_dude.c

The perfstat_dude.c program in Example A-2 makes one reading of a selected number of statistics, then waits for a specified amount of time before it takes the other reading.

Example A-2. perfstat_dude.c program
#include <stdio.h> #include <stdlib.h> #include <sys/var.h> #include <libperfstat.h> #defineNCPU1024 #defineNDISK1024 #defineNNETWORK1024 static intncpu = NCPU; static intndisk = NDISK; static intnnetwork = NNETWORK; cpu_t(int t) { perfstat_id_tname; perfstat_cpu_tub[NCPU]; int i, rc; static u_longlong_tttime[NCPU]; static u_longlong_tuser[NCPU]; static u_longlong_tsys[NCPU]; static u_longlong_tidle[NCPU]; static u_longlong_twait[NCPU]; static u_longlong_tsysfork[NCPU]; static u_longlong_tsyscall[NCPU]; static u_longlong_tpswitch[NCPU]; ...

Get AIX 5L Practical Performance Tools and Tuning Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.