ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/memory_stats.c
Revision 1.37 - (view) (annotate) - [select for diffs]
Sun Oct 3 18:35:57 2010 UTC (13 years, 6 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.36: +26 -1 lines
Diff to previous 1.36
Add support for AIX 5.x - 9.x.

Many thanks to Jens Rehsack <rehsack@googlemail.com> for providing the
patch for this work. Thanks!

Revision 1.36 - (view) (annotate) - [select for diffs]
Sun Feb 21 10:04:26 2010 UTC (14 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_17
Changes since 1.35: +4 -4 lines
Diff to previous 1.35
Support larger amounts of memory on FreeBSD.

Revision 1.35 - (view) (annotate) - [select for diffs]
Mon Jun 18 20:56:22 2007 UTC (16 years, 10 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_15, LIBSTATGRAB_0_16
Changes since 1.34: +35 -16 lines
Diff to previous 1.34
Fix memory stats on OpenBSD - they were returning results in the wrong
units.

Patch submitted by:	David Love <david@homeunix.org.uk>

Revision 1.34 - (view) (annotate) - [select for diffs]
Mon Oct 30 08:20:05 2006 UTC (17 years, 6 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_14
Changes since 1.33: +2 -2 lines
Diff to previous 1.33
Fix compile problem in last commit.

Revision 1.33 - (view) (annotate) - [select for diffs]
Sun Oct 29 23:01:16 2006 UTC (17 years, 6 months ago) by tdb
Branch: MAIN
Changes since 1.32: +45 -9 lines
Diff to previous 1.32
Fix memory stats on OpenBSD. Currently untested.

Submitted by: bsd@openbsd.rutgers.edu

Revision 1.32 - (view) (annotate) - [select for diffs]
Sat Sep 24 13:29:22 2005 UTC (18 years, 7 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_13
Changes since 1.31: +21 -1 lines
Diff to previous 1.31
Add WIN32 support via MINGW. We'll need to add stuff to the README file
about what this requires to build.

All the hard work done by: skel

Revision 1.31 - (view) (annotate) - [select for diffs]
Sat Nov 6 14:55:53 2004 UTC (19 years, 5 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_11, LIBSTATGRAB_0_11_1, LIBSTATGRAB_0_12
Changes since 1.30: +6 -5 lines
Diff to previous 1.30
Add sg_get_pstat_static for HP-UX. (Untested.)

Revision 1.30 - (view) (annotate) - [select for diffs]
Mon Nov 1 18:30:17 2004 UTC (19 years, 6 months ago) by tdb
Branch: MAIN
Changes since 1.29: +30 -1 lines
Diff to previous 1.29
Merge in patch to provide support for HP-UX 11.11.

Contributed by Roy Keene - thanks Roy!

Revision 1.29 - (view) (annotate) - [select for diffs]
Sun Jul 18 21:31:32 2004 UTC (19 years, 9 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_10_1, LIBSTATGRAB_0_10_2, LIBSTATGRAB_0_10_3
Changes since 1.28: +2 -7 lines
Diff to previous 1.28
getpagesize() cannot fail.

Revision 1.28 - (view) (annotate) - [select for diffs]
Sun Jul 18 21:30:11 2004 UTC (19 years, 9 months ago) by ats
Branch: MAIN
Changes since 1.27: +12 -8 lines
Diff to previous 1.27
Use sg_set_error_with_errno whenever errno's valid.
Change the one user of SG_ERROR_ENOENT to SG_ERROR_SYSCTL instead (since
that's what it should have been).

Revision 1.27 - (view) (annotate) - [select for diffs]
Wed Apr 7 21:08:40 2004 UTC (20 years ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_10
Changes since 1.26: +20 -8 lines
Diff to previous 1.26
The rest of the error handling stuff (except the vector code).

I've been extremely unimaginative with the string names in error.c, but
they're all in one place so much easier to tidy up. I'm also beginning to
wonder if we actually needed an SG_ERROR_SYSTEM_CALL to indicate some call
into the system failed - because the majority of our errors are those :-)

Still to do, then:
 - vector code
 - better string names in error.c
 - deal with arg string in some way
 - make use of the error status in statgrab/saidar/examples

Revision 1.26 - (view) (annotate) - [select for diffs]
Wed Apr 7 14:53:40 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25
Whitespace tidyup - change spaces to tabs.

Revision 1.25 - (view) (annotate) - [select for diffs]
Tue Apr 6 14:52:58 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24
Update name of project at the top of all soure files. These files now exist
in their own right, rather than as part of the "CMS".

Revision 1.24 - (view) (annotate) - [select for diffs]
Mon Apr 5 15:40:15 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.23: +5 -5 lines
Diff to previous 1.23
Rename all the functions, types and enums in the API to be consistent.
Types are now of the form "sg_mem_stats"; functions of the form
"sg_get_mem_stats"; enums of the form "SG_PROCESS_STATE_RUNNING".
(The old get_proc_snapshot follows the usual calling convention now.)

Make internal functions static where possible.

Rename non-static internal functions to have an sg_ prefix so they don't
collide with those from other libraries. In particular, strlcpy and
strlcat are now called sg_strlcpy and sg_strlcat and are always
included.

Fix saidar and statgrab to use the new API.

Revision 1.23 - (view) (annotate) - [select for diffs]
Mon Feb 16 14:55:32 2004 UTC (20 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_9
Changes since 1.22: +4 -4 lines
Diff to previous 1.22
Add support for DragonFly BSD 1.0.
Also a minor tweak to the network interface code to make it more portable.

Revision 1.22 - (view) (annotate) - [select for diffs]
Sat Feb 14 00:04:12 2004 UTC (20 years, 2 months ago) by ats
Branch: MAIN
Changes since 1.21: +2 -1 lines
Diff to previous 1.21
uvm.h needs sys/time.h on NetBSD to get struct timeval.

Revision 1.21 - (view) (annotate) - [select for diffs]
Fri Feb 13 16:46:21 2004 UTC (20 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.20: +4 -31 lines
Diff to previous 1.20
Finish support for OpenBSD.

Get disknames out of sysctl as well for Disk IO.
Fix memory/page/swap stats to use get_uvmexp in tools.c (same as NetBSD).

Revision 1.20 - (view) (annotate) - [select for diffs]
Thu Feb 12 23:04:52 2004 UTC (20 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.19: +39 -2 lines
Diff to previous 1.19
Add preliminary support for OpenBSD (tested on 3.3).

All works apart from Disk IO stats - currently the disks are not named
correctly. The fix for this is probably to use KVM.

Mostly similar to the NetBSD code, the notable exception being the uvm
stuff. In NetBSD there's a function to get it, in OpenBSD sysctl is needed
to get hold of it.

Revision 1.19 - (view) (annotate) - [select for diffs]
Mon Jan 19 16:49:21 2004 UTC (20 years, 3 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_8_1, LIBSTATGRAB_0_8_2
Changes since 1.18: +2 -0 lines
Diff to previous 1.18
A whole bunch of minor cosmetic changes.

Revision 1.18 - (view) (annotate) - [select for diffs]
Fri Jan 16 15:54:54 2004 UTC (20 years, 3 months ago) by tdb
Branch: MAIN
Changes since 1.17: +13 -12 lines
Diff to previous 1.17
Alter the licensing of libstatgrab. The library part is now under the
LGPL, whilst the tools/examples are under the GPL. Both licenses are
included in the distribution (and are both now in CVS). Also made a
minor alteration to the webpage where it said everything was licensed
under the GPL.

Revision 1.17 - (view) (annotate) - [select for diffs]
Mon Nov 10 23:25:45 2003 UTC (20 years, 5 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_8
Changes since 1.16: +3 -3 lines
Diff to previous 1.16
Make Cygwin its own platform, rather than defining LINUX. This stops
libstatgrab from trying to fetch stats that Cygwin doesn't have.

Revision 1.16 - (view) (annotate) - [select for diffs]
Fri Oct 24 17:26:43 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.15: +2 -3 lines
Diff to previous 1.15
Support memory, swap and paging stats on Linux 2.6. For memory and swap,
this just means reading the new-style data in /proc/meminfo (since it's
present in 2.2 and 2.4 too); for paging, this means trying to read
/proc/vmstat if it's available, else reading /proc/stat (for 2.2).

Revision 1.15 - (view) (annotate) - [select for diffs]
Fri Oct 24 17:03:20 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.14: +17 -18 lines
Diff to previous 1.14
Initial Linux 2.6 support.

Revision 1.14 - (view) (annotate) - [select for diffs]
Mon Oct 20 18:13:35 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_7
Changes since 1.13: +8 -17 lines
Diff to previous 1.13
Clean up NetBSD memory calculations.

Revision 1.13 - (view) (annotate) - [select for diffs]
Sun Oct 19 02:11:50 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.12: +0 -1 lines
Diff to previous 1.12
Dear patch(1),
  Kindly don't insert random lines from my code into the middle of
other peoples' sscanfs.
       love,
         Adam

Revision 1.12 - (view) (annotate) - [select for diffs]
Sun Oct 19 02:03:02 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.11: +31 -6 lines
Diff to previous 1.11
Initial support for NetBSD. This adds NetBSD support for everything
except diskio stats (since they're even more disturbingly complex to get
at on NetBSD than the three OSs we already support). Tested against
NetBSD 1.6 on i386.

Revision 1.11 - (view) (annotate) - [select for diffs]
Sat Oct 18 23:04:23 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.10: +4 -0 lines
Diff to previous 1.10
... and the size parameter should be initialised to the size of the
buffer first (although FreeBSD doesn't actually seem to care, NetBSD
does, and the manual page says so).

Revision 1.10 - (view) (annotate) - [select for diffs]
Sat Oct 18 22:15:35 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.9: +4 -16 lines
Diff to previous 1.9
You only need to call sysctl{,byname}() twice if you're actually going
  to do something with the size the first call returns.
The last argument to sysctl{,byname}() is a size_t, not a pointer, so it
  should be 0, not NULL.

Revision 1.9 - (view) (annotate) - [select for diffs]
Sat Oct 18 12:40:10 2003 UTC (20 years, 6 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_6_1
Changes since 1.8: +1 -1 lines
Diff to previous 1.8
Fix the total memory that I broke in the last commit.

Revision 1.8 - (view) (annotate) - [select for diffs]
Sat Oct 18 12:28:32 2003 UTC (20 years, 6 months ago) by tdb
Branch: MAIN
Changes since 1.7: +19 -16 lines
Diff to previous 1.7
Fix the FreeBSD memory code. The sysctl calls are returning ints, not
long longs, so putting the values straight in to long longs was breaking.
Now put the values into ints and then fill in the structure afterwards.

This, for some reason, only showed up on FreeBSD 5.1/sparc64. The changed
code works on the other FreeBSD's too.

One bug still outstanding: on sparc64 the total memory isn't working.

Revision 1.7 - (view) (annotate) - [select for diffs]
Sun Aug 24 20:24:09 2003 UTC (20 years, 8 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_5, LIBSTATGRAB_0_5_1, LIBSTATGRAB_0_6
Changes since 1.6: +2 -2 lines
Diff to previous 1.6
Tidy up of lots of little things. :)

Revision 1.6 - (view) (annotate) - [select for diffs]
Thu Apr 3 20:05:10 2003 UTC (21 years, 1 month ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_4
Changes since 1.5: +59 -0 lines
Diff to previous 1.5
Should now work happily on freebsd. sysctlbyname seems to return a lot of
things in long's. Im not completely trusting this code, but it does appear
to work, and its the same as the old implementation.

Revision 1.5 - (view) (annotate) - [select for diffs]
Wed Mar 5 21:00:59 2003 UTC (21 years, 1 month ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_3, LIBSTATGRAB_0_3_1, LIBSTATGRAB_0_3_2, LIBSTATGRAB_0_3_3, LIBSTATGRAB_0_3_4
Changes since 1.4: +36 -1 lines
Diff to previous 1.4
Updated Memory stats to work with linux.

Revision 1.4 - (view) (annotate) - [select for diffs]
Fri Feb 28 22:59:35 2003 UTC (21 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_2
Changes since 1.3: +0 -8 lines
Diff to previous 1.3
Tidy up of configure script, and includes.

Revision 1.3 - (view) (annotate) - [select for diffs]
Thu Feb 20 13:19:52 2003 UTC (21 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.2: +0 -1 lines
Diff to previous 1.2
Removed references to ukcprog.h.
Fixed a missing * in the disk stats.
And removed a block of linux stuff that shouldn't have been there :-)
All with Pete's approval, of course.

Revision 1.2 - (view) (annotate) - [select for diffs]
Tue Feb 18 23:23:36 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.1: +2 -3 lines
Diff to previous 1.1
Changed the kstat_close to not return NULL in event of a failure. If we
cant close it, well there is nothing i can do about that, so i may as well
at least return something useful since its done all the hardwork by that
point. And anywan, it should never fail to close :)

Revision 1.1 - (view) (annotate) - [select for diffs]
Tue Feb 18 19:28:30 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
The new revesion of libstatgrab, which is a complete rewrite essentially.

Firstly the data is now returned in structures rather than xml strings.
The structures returned are all static, so what ever calls the library doesn't
have to deal with the memory management of it.

Secondly the general efficency of the code is now significantly faster. It no
longer needs to fork a process, connect file descriptors and run ps, and then
parse the output like it used to. Now it walks /proc and reads it into the
correct data structures. This works without needing any special privilages, so
it can still run as a normal mortal without needing any special group. (Freebsd
will be an exception to this, but this commit only works with solaris, and that
requires nothing special)

Thridly it has more functionality than it used to. It not for instance is capable
of showing network traffic stats, (although its not completely finished yet). It
also in the near future be able to disk io stats as well. Several bug fixes have
been aplied over the original version. For example the cpu_stats used to only reply
the stats for the first processor. This now will report the total stats of all of
them. Paging stats will also be fixed, but haven't been done yet.

Convenience Links

Links to HEAD: (view) (annotate)

Compare Revisions

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a