1MemInfo(3) User Contributed Perl Documentation MemInfo(3)
2
3
4
5Sys::MemInfo - Memory informations
6
8 use Sys::MemInfo qw(totalmem freemem totalswap);
9
10 print "total memory: ".(&totalmem / 1024)."\n";
11 print "free memory: ".(&freemem / 1024)."\n";
12
13 print "total swap: ".(&totalswap / 1024)."\n";
14 print "free swap: ".(Sys::MemInfo::get("freeswap") / 1024)."\n";
15
17 Sys::MemInfo return the total amount of free and used physical memory
18 in bytes in totalmem and freemem variables.
19
20 Total amount of free and user swap memory are alse returned in
21 totalswap and freeswap variables.
22
23 This module has been tested on Linux 2.6.10, UnixWare 7.1.2, AIX5,
24 OpenBSD 3.8, NetBSD 2.0.2, FreBSD 5.4, HPUX11, Solaris 9, Tru64 5.1,
25 Irix 6.5, Mac OS X 10.2 darwin and Windows XP.
26
27 It should work on FreeBSD 4 and Windows 9X/ME/NT/200X/Vista.
28
30 availkeys
31 Return list of all accessor keys (freemem, totalmem, etc.) This is
32 useful for dumping out all known information from the object by
33 calling get() on all of the returned keys.
34
35 freemem
36 Returns free physical memory in bytes.
37
38 freeswap
39 Returns free swap space in bytes.
40
41 get Returns the value of the passed key.
42
43 totalmem
44 Returns total physical memory size in bytes.
45
46 totalswap
47 Returns total swap space in bytes.
48
50 Sylvain Cresto <scresto@gmail.com>
51
52 Thanks to Laurent Dufour and Wilson Snyder.
53
55 Please send bug-reports to scresto@gmail.com
56
58 This library is free software; you can redistribute it and/or modify it
59 under the terms of the GNU Lesser General Public License as published
60 by the Free Software Foundation; either version 2.1 of the License, or
61 (at your option) any later version.
62
63 This library is distributed in the hope that it will be useful, but
64 WITHOUT ANY WARRANTY; without even the implied warranty of
65 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
66 Lesser General Public License for more details.
67
68 You should have received a copy of the GNU Lesser General Public
69 License along with this library; if not, write to the Free Software
70 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
71
73 Copyright (C) 2005, 2006 - Sylvain Cresto
74
75
76
77perl v5.16.3 2006-11-09 MemInfo(3)