Mercurial > hg > toybox
comparison toys/vmstat.c @ 562:4d802d438983
Match uint64_t with PRIu64 to avoid warnings on 64 bit builds.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 14 Apr 2012 21:27:00 -0500 |
parents | c97e338a4126 |
children |
comparison
equal
deleted
inserted
replaced
561:c97e338a4126 | 562:4d802d438983 |
---|---|
33 if ( s == sizeof(toybuf)-1) | 33 if ( s == sizeof(toybuf)-1) |
34 error_exit("/proc/stat is too large"); | 34 error_exit("/proc/stat is too large"); |
35 | 35 |
36 off = strstr(toybuf, "cpu "); | 36 off = strstr(toybuf, "cpu "); |
37 // Ignoring steal and guest fields for now. | 37 // Ignoring steal and guest fields for now. |
38 if (off) sscanf(off, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &c_user, &c_nice, &c_sys, cpu_idle, cpu_wait, &c_irq, &c_sirq); | 38 if (off) sscanf(off, "cpu %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64 \ |
39 " %"PRIu64" %"PRIu64" %"PRIu64, &c_user, &c_nice, &c_sys, cpu_idle, | |
40 cpu_wait, &c_irq, &c_sirq); | |
39 *cpu_user = c_user + c_nice; | 41 *cpu_user = c_user + c_nice; |
40 *cpu_sys = c_sys + c_irq + c_sirq; | 42 *cpu_sys = c_sys + c_irq + c_sirq; |
41 off = strstr(toybuf, "intr"); | 43 off = strstr(toybuf, "intr"); |
42 if (off) sscanf(off, "intr %Lu", sys_irq); | 44 if (off) sscanf(off, "intr %"PRIu64, sys_irq); |
43 | 45 |
44 off = strstr(toybuf, "ctxt"); | 46 off = strstr(toybuf, "ctxt"); |
45 if (off) sscanf(off, "ctxt %Lu", sys_ctxt); | 47 if (off) sscanf(off, "ctxt %"PRIu64, sys_ctxt); |
46 | 48 |
47 off = strstr(toybuf, "procs_running"); | 49 off = strstr(toybuf, "procs_running"); |
48 if (off) sscanf(off, "procs_running %u", proc_running); | 50 if (off) sscanf(off, "procs_running %u", proc_running); |
49 (*proc_running)--; // look, i'm invisible. | 51 (*proc_running)--; // look, i'm invisible. |
50 | 52 |