You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2006/07/07 10:01:57 UTC
BSD::Resource and getrusage(2)
Hi, I'm trying do determine the units for one of the fields returned by getrusage(2)
man page on 6.0-RELEASE-p5 says this:
2 maxrss maximum shared memory or current resident set
3 ixrss integral shared memory
ru_ixrss
an ``integral'' value indicating the amount of memory used
by the text segment that was also shared among other pro-
cesses. This value is expressed in units of
kilobytes * ticks-of-execution.
Ticks are statistics clock ticks.
The statistics clock has a frequency of sysconf(_SC_CLK_TCK)
which to me implies thats in kilobytes, but to the contrary, we have the following
CPAN rt: https://rt.cpan.org/Ticket/Display.html?id=18230
I'll paste the import part of this here so you don't have to follow the link
>ApacheSizeLimit on bsd systems uses BSD::Resource to get the memory and
>shared-pages size.
> sub bsd_size_check {
> return (&BSD::Resource::getrusage())[2,3];
> }
I also have a local test based on the recent Apache::SizeLimit work from Dave Rolsky
where
maxrss > ixrss
(Apache-Test output snipped)
# '14124' maxrss
# >
# '52080' ixrss
I tried looking in src/sys/kern/kern_resource.c but I didn't find anything that told me the units.
My inkling is the documentation is WRONG.
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F
"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: BSD::Resource and getrusage(2) [PATCH]
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
server localhost:8529 started
t/apache/basic.........ok
t/apache/deprecated....ok
t/pod..................ok
All tests successful.
Files=3, Tests=18, 2 wallclock secs ( 0.98 cusr + 0.12 csys = 1.09 CPU)
[warning] server localhost:8529 shutdown
[That was from svn trunk, after patch applied]
--
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F
"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: BSD::Resource and getrusage(2) [PATCH]
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> Doesn't that imply that it's in kb per stat clock ticks?
I think you read it backwards, but I agree with the outcome.
svn diff
Index: lib/Apache/SizeLimit.pm
===================================================================
--- lib/Apache/SizeLimit.pm (revision 419830)
+++ lib/Apache/SizeLimit.pm (working copy)
@@ -247,8 +247,15 @@
return ( $size, 0 );
}
+## rss is in KB
+## ixrss is in BYTES
+## this is true on at least FreeBSD, OpenBSD, NetBSD, and Darwin
sub _bsd_size_check {
- return ( BSD::Resource::getrusage() )[ 2, 3 ];
+ my @results = BSD::Resource::getrusage();
+ my $max_rss = $results[2];
+ my $max_ixrss = int ( $results[3] / 1024 );
+
+ return ( $max_rss, $max_ixrss );
}
--
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F
"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: BSD::Resource and getrusage(2)
Posted by Dave Rolsky <au...@urth.org>.
On Fri, 7 Jul 2006, Philip M. Gollucci wrote:
> Hi, I'm trying do determine the units for one of the fields returned by getrusage(2)
>
> man page on 6.0-RELEASE-p5 says this:
> 2 maxrss maximum shared memory or current resident set
> 3 ixrss integral shared memory
>
> ru_ixrss
> an ``integral'' value indicating the amount of memory used
> by the text segment that was also shared among other pro-
> cesses. This value is expressed in units of
>
> kilobytes * ticks-of-execution.
>
> Ticks are statistics clock ticks.
> The statistics clock has a frequency of sysconf(_SC_CLK_TCK)
>
> which to me implies thats in kilobytes, but to the contrary, we have the following
Doesn't that imply that it's in kb per stat clock ticks?
>> ApacheSizeLimit on bsd systems uses BSD::Resource to get the memory and
>> shared-pages size.
>> sub bsd_size_check {
>> return (&BSD::Resource::getrusage())[2,3];
>> }
>
> I also have a local test based on the recent Apache::SizeLimit work from Dave Rolsky
> where
>
> maxrss > ixrss
> (Apache-Test output snipped)
> # '14124' maxrss
> # >
> # '52080' ixrss
>
> I tried looking in src/sys/kern/kern_resource.c but I didn't find anything that told me the units.
>
> My inkling is the documentation is WRONG.
If it's reported share memory as greater than total memory, then I think
the docs for BSD::Resource are correct. We need to divide that second
number (ixrss) by the value of the stat clock tick. Any idea how that can
be determined?
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org