-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2014-04-07 at 21:45 +0200, Carlos E. R. wrote:
On 2014-04-07 19:51, Linda Walsh wrote:
I'd have to package it up for distribution (written in perl).
I was thinking about writing my own app, in pascal. But I don't know where to get the info from.
I have got so far as to replicate "free" and "uptime" - more or less :-) +++························· cer@Telcontar:~/bin/lazarus/mios/SystemInfo> uptime ; echo ; free -b -l ; echo ; ./systeminfo 02:16 up 7:07, 31 users, load average: 0,09, 0,29, 0,30 total used free shared buffers cached Mem: 8390156288 8143261696 246894592 79347712 1020768256 3626921984 Low: 8390156288 8143261696 246894592 High: 0 0 0 - -/+ buffers/cache: 3495571456 4894584832 Swap: 22545416192 14831616 22530584576 Uptime: 0d 7:7:34 Load avg: 0.093/0.318/0.332 (719 processes). total used free shared buffers cached Mem : 8390 --- 246 0 1020 --- Swap : 22545 --- 22530 High : 0 --- 0 mem_unit: 1 ·························++- I found a system call that returns all that data (SysInfo). Besides reformatting the output for easier comparison with the system utilities, the documentation and the example code were all wrong, I had to look up the pascal .h equivalent of the definitions. The load average could be wrong. As I'm not having to read /proc so far, this part is very fast. If I could find more function calls for the rest of the data, it would be wonderful. Besides, I found a bug, I think, on the "free" output. The help says: Options: -b, --bytes show output in bytes -k, --kilo show output in kilobytes -m, --mega show output in megabytes -g, --giga show output in gigabytes --tera show output in terabytes -h, --human show human readable output --si use powers of 1000 not 1024 Now compare: cer@Telcontar:~> free -b ; echo ; free --si ; echo ; free -k total used free shared buffers cached Mem: 8390156288 8132198400 257957888 79638528 1021140992 3621867520 (plain bytes) - -/+ buffers/cache: 3489189888 4900966400 Swap: 22545416192 14831616 22530584576 total used free shared buffers cached Mem: 8193512 7941864 251648 77772 997208 3536980 (SI, it says - -/+ buffers/cache: 3407676 4785836 Swap: 22017008 14484 22002524 total used free shared buffers cached Mem: 8193512 7941844 251668 77772 997208 3536980 (KB, it says) - -/+ buffers/cache: 3407656 4785856 Swap: 22017008 14484 22002524 cer@Telcontar:~> Those are not "SI" units. Or, either the "-k" output is wrong, or the "--si" output is wrong... and as the SI output should be the bytes divided by powers of 1000, and it is obviously not so, it is using KiB in fact for SI units. YIKSS! - -- Cheers, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlNDQp8ACgkQtTMYHG2NR9XVAQCglvFLWNv48j2Ssc3L7jrqZqYB rb8AoJMo2iGrsK0lnPhOmTE+VznLEWaY =2uW4 -----END PGP SIGNATURE-----