NAME
Linux::MemInfo - Perl extension for accessing /proc/meminfo
SYNOPSIS
use Linux::MemInfo;
ABSTRACT
This module will allow you to easily extract the fields out of the
/proc/meminfo file. All of the fields are stored in a hash.
DESCRIPTION
%mem = get_mem_info
foreach(sort keys %mem) {
printf("%-20s\t%s\n",$_,$mem{$_});
}
Would yield the following:
Active 371368
ActiveAnon 104980
ActiveAnon_unit kB
ActiveCache 266388
ActiveCache_unit kB
Active_unit kB
Buffers 80968
Buffers_unit kB
Cached 272400
Cached_unit kB
HighFree 0
HighFree_unit kB
HighTotal 0
HighTotal_unit kB
Inact_clean 9976
Inact_clean_unit kB
Inact_dirty 0
Inact_dirty_unit kB
Inact_laundry 75480
Inact_laundry_unit kB
Inact_target 91364
Inact_target_unit kB
LowFree 11172
LowFree_unit kB
LowTotal 512540
LowTotal_unit kB
MemFree 11172
MemFree_unit kB
MemShared 0
MemShared_unit kB
MemTotal 512540
MemTotal_unit kB
SwapCached 6768
SwapCached_unit kB
SwapFree 505096
SwapFree_unit kB
SwapTotal 522072
SwapTotal_unit kB
mem_buffers 82911232
mem_cached 285868032
mem_free 11440128
mem_shared 0
mem_total 524840960
mem_used 513400832
swap_free 517218304
swap_total 534601728
swap_used 17383424
The raw data looks like this:
total: used: free: shared: buffers: cached:
Mem: 524840960 510504960 14336000 0 81543168 283406336
Swap: 534601728 17448960 517152768
MemTotal: 512540 kB
MemFree: 14000 kB
MemShared: 0 kB
Buffers: 79632 kB
Cached: 269932 kB
SwapCached: 6832 kB
Active: 371352 kB
ActiveAnon: 106300 kB
ActiveCache: 265052 kB
Inact_dirty: 0 kB
Inact_laundry: 73628 kB
Inact_clean: 9296 kB
Inact_target: 90852 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 512540 kB
LowFree: 14000 kB
SwapTotal: 522072 kB
SwapFree: 505032 kB
SEE ALSO
None
AUTHOR
Chad Kerner, <chadkerner@yahoo.com<gt>
COPYRIGHT AND LICENSE
Copyright 2003 by Chad Kerner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.