--- projects/libstatgrab/examples/cpu_usage.c 2004/04/04 22:48:49 1.8 +++ projects/libstatgrab/examples/cpu_usage.c 2004/04/05 16:23:08 1.9 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: cpu_usage.c,v 1.8 2004/04/04 22:48:49 tdb Exp $ + * $Id: cpu_usage.c,v 1.9 2004/04/05 16:23:08 tdb Exp $ */ #include @@ -31,7 +31,7 @@ int main(int argc, char **argv){ int c; int delay = 1; - cpu_percent_t *cpu_percent; + sg_cpu_percents *cpu_percent; while ((c = getopt(argc, argv, "d:")) != -1){ switch (c){ @@ -42,21 +42,21 @@ int main(int argc, char **argv){ } /* Initialise statgrab */ - statgrab_init(); + sg_init(); /* Drop setuid/setgid privileges. */ - if (statgrab_drop_privileges() != 0) { + if (sg_drop_privileges() != 0) { perror("Error. Failed to drop privileges"); return 1; } /* Throw away the first reading as thats averaged over the machines uptime */ - cpu_percent = cpu_percent_usage(); + cpu_percent = sg_get_cpu_percents(); /* Clear the screen ready for display the cpu usage */ printf("\033[2J"); - while( (cpu_percent = cpu_percent_usage()) != NULL){ + while( (cpu_percent = sg_get_cpu_percents()) != NULL){ printf("\033[2;2H%-12s : %6.2f", "User CPU", cpu_percent->user); printf("\033[3;2H%-12s : %6.2f", "Kernel CPU", cpu_percent->kernel); printf("\033[4;2H%-12s : %6.2f", "IOWait CPU", cpu_percent->iowait);