May 2005
Intermediate to advanced
738 pages
18h 22m
English
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.
#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]; ... |
Read now
Unlock full access