DashProfiler
view release on metacpan or search on metacpan
Added more docs, especially to UserGuide and Auto.
=head2 DashProfiler 1.05 - r25 - Aug 10 2007
Added :optional to DashProfiler::Import
Added dbi_profile_args to pass extra args to dbi_profile_class->new().
Added DashProfiler::Auto for simple uses, including one-liners
Added lots of documentation.
Require perl 5.8 (just due to sprintf '%$N' usage in tests). Works for 5.6
Made Scalar::Util::weaken optional.
Removed spool_directory arg (use dbi_profile_args => { Dir => ... } instead)
Set local $ENV{DBI_AUTOPROXY} to avoid risk of problems
Generalized get_dbi_profile() to take a '*'
start_sample_period and end_sample_period check for overlaps
end_sample_period now returns period_sample DBI Profile object not dbh
Changed semantics of flush_hook return value.
=head2 DashProfiler 1.03 - r15 - Jun 23 2007
Fix flush_hook attribute in flush(),
lib/DashProfiler/Core.pm view on Meta::CPAN
# if Hash::Util isn't available then install a stub for lock_keys()
eval {
require Hash::Util;
Hash::Util->import('lock_keys');
};
die @$ if $@ && $@ !~ /^Can't locate Hash\/Util/;
*lock_keys = sub { } if not defined &lock_keys;
}
# check for weaken support, used by ChildHandles
my $HAS_WEAKEN = eval {
require Scalar::Util;
# this will croak() if this Scalar::Util doesn't have a working weaken().
Scalar::Util::weaken( my $test = [] );
1;
};
*weaken = sub { croak "Can't weaken without Scalar::Util::weaken" }
unless $HAS_WEAKEN;
# On 2GHz OS X 10.5.2 laptop:
# sample_overhead_time = 0.000014s
# sample_inner_time = 0.000003s
my ($sample_overhead_time, $sample_inner_time) = estimate_sample_overheads();
=head1 CLASS METHODS
lib/DashProfiler/Core.pm view on Meta::CPAN
my $dbh = DBI->connect("dbi:DashProfiler:", "", "", {
Profile => $dbi_profile,
RaiseError => 1, PrintError => 1, TraceLevel => 0,
});
$dbh = tied %$dbh; # switch to inner handle
$dbh->{Profile}->empty; # discard FETCH&STOREs etc due to connect()
for my $handles ($self->{dbi_handles_all}, $self->{dbi_handles_active}) {
# clean out any dead weakrefs
defined $handles->{$_} or delete $handles->{$_} for keys %$handles;
$handles->{$dbi_profile_name} = $dbh;
# weaken($handles->{$dbi_profile_name}) if $weakly; # not currently documented or used
}
return $dbh;
}
sub _attach_new_temporary_plain_profile { # not currently documented or used
my ($self, $dbi_profile_name) = @_;
# create new DBI profile (with no time key) that doesn't flush anywhere
my $dbi_profile = $self->_mk_dbi_profile("DashProfiler::DumpNowhere", 0);
# attach to the profile, but only weakly
( run in 0.566 second using v1.01-cache-2.11-cpan-65fba6d93b7 )