O'Reilly logo

AIX 5L Practical Performance Tools and Tuning Guide by IBM Redbooks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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]; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required