Revision: 1363
Author: [email protected]
Date: Sun Sep 19 04:04:28 2010
Log: Added experimental BSD::Resource usage tracking
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1363
Modified:
/trunk/t/lib/NYTProfTest.pm
=======================================
--- /trunk/t/lib/NYTProfTest.pm Sat Jul 10 07:56:39 2010
+++ /trunk/t/lib/NYTProfTest.pm Sun Sep 19 04:04:28 2010
@@ -26,6 +26,8 @@
my $diff_opts = ($Config{osname} eq 'MSWin32') ? '-c' : '-u';
+eval { require BSD::Resource } if $ENV{NYTPROF_TEST_RUSAGE}; # experimental
+
my %opts = (
one => $ENV{NYTPROF_TEST_ONE},
profperlopts => $ENV{NYTPROF_TEST_PROFPERLOPTS} || '-d:NYTProf',
@@ -138,6 +140,8 @@
sub do_foreach_opt_combination {
my ($opt_combinations, $code) = @_;
+ my $rusage_start = get_rusage();
+
COMBINATION:
for my $env (@$opt_combinations) {
@@ -165,6 +169,7 @@
for keys %$env;
$env_failed{ $ENV{NYTPROF} } = $failed;
}
+ report_rusage($rusage_start);
}
@@ -608,6 +613,18 @@
}
+sub get_rusage {
+ return scalar eval {
BSD::Resource::getrusage(BSD::Resource::RUSAGE_CHILDREN()) };
+}
+
+sub report_rusage {
+ my $ru1 = shift or return;
+ my $ru2 = get_rusage();
+ my %diff;
+ $diff{$_} = $ru2->$_ - $ru1->$_ for (qw(maxrss));
+ warn " maxrss: $diff{maxrss}\n";
+}
+
1;
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]