Elvira Khabirova | 22d997e | 2015-08-03 06:30:49 +0300 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <sys/sysinfo.h> |
| 3 | |
| 4 | int |
| 5 | main (void) |
| 6 | { |
| 7 | struct sysinfo si; |
| 8 | if (sysinfo(&si) == -1) |
| 9 | return 77; |
| 10 | printf("sysinfo({uptime=%llu" |
| 11 | ", loads=[%llu, %llu, %llu]" |
| 12 | ", totalram=%llu" |
| 13 | ", freeram=%llu" |
| 14 | ", sharedram=%llu" |
| 15 | ", bufferram=%llu" |
| 16 | ", totalswap=%llu" |
| 17 | ", freeswap=%llu" |
| 18 | ", procs=%u" |
| 19 | ", totalhigh=%llu" |
| 20 | ", freehigh=%llu" |
| 21 | ", mem_unit=%u" |
| 22 | "}) = 0\n", |
| 23 | (unsigned long long) si.uptime |
| 24 | , (unsigned long long) si.loads[0] |
| 25 | , (unsigned long long) si.loads[1] |
| 26 | , (unsigned long long) si.loads[2] |
| 27 | , (unsigned long long) si.totalram |
| 28 | , (unsigned long long) si.freeram |
| 29 | , (unsigned long long) si.sharedram |
| 30 | , (unsigned long long) si.bufferram |
| 31 | , (unsigned long long) si.totalswap |
| 32 | , (unsigned long long) si.freeswap |
| 33 | , (unsigned) si.procs |
| 34 | , (unsigned long long) si.totalhigh |
| 35 | , (unsigned long long) si.freehigh |
| 36 | , si.mem_unit |
| 37 | ); |
| 38 | puts("+++ exited with 0 +++"); |
| 39 | return 0; |
| 40 | } |