Bio::EnsEMBL::Utils
EprofStack
Toolbar
Summary
Bio::EnsEMBL::Util::EprofStack - DESCRIPTION of Object
Package variables
No package variables defined.
Included modules
Synopsis
Description
Methods
Methods description
Title : current_start Usage : $obj->current_start($newval) Function: Returns : value of current_start Args : newvalue (optional) |
Title : is_active Usage : $obj->is_active($newval) Function: Returns : value of is_active Args : newvalue (optional) |
Title : max_time Usage : $obj->max_time($newval) Function: Returns : value of max_time Args : newvalue (optional) |
Title : min_time Usage : $obj->min_time($newval) Function: Returns : value of min_time Args : newvalue (optional) |
Title : number Usage : $obj->number($newval) Function: Returns : value of number Args : newvalue (optional) |
Title : pop_stack Usage : Function: Example : Returns : Args : |
Title : push_stack Usage : Function: Example : Returns : Args : |
Title : tag Usage : $obj->tag($newval) Function: Returns : value of tag Args : newvalue (optional) |
Title : total_time Usage : $obj->total_time($newval) Function: Returns : value of total_time Args : newvalue (optional) |
Title : total_time_time Usage : $obj->total_time_time($newval) Function: Returns : value of total_time_time Args : newvalue (optional) |
Methods code
BEGIN { eval {
require Time::HiRes;
Time::HiRes->import('time');
}; } |
sub current_start
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'current_start'} = $value }
return $self->{'current_start'}; } |
sub is_active
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'is_active'} = $value }
return $self->{'is_active'}; } |
sub max_time
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'max_time'} = $value }
return $self->{'max_time'}; } |
sub min_time
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'min_time'} = $value }
return $self->{'min_time'}; } |
sub new
{ my ( $proto, $name ) = @_;
my $class = ref($proto) || $proto;
my $self = bless( { 'is_active' => 0,
'total_time' => 0,
'total_time_time' => 0,
'max_time' => 0,
'min_time' => 999999999,
'number' => 0,
'tag' => $name
},
$class );
return $self; } |
sub number
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'number'} = $value }
return $self->{'number'}; } |
sub pop_stack
{ my ( $self, @args ) = @_;
if ( $self->{'is_active'} == 0 ) {
warning(
sprintf( "Attempting to pop stack on tag '%s' "
. "when not active. Ignoring.",
$self->tag() ) );
}
my $clocktime = time() - $self->{'current_start'};
if ( $self->{'max_time'} < $clocktime ) {
$self->{'max_time'} = $clocktime;
}
if ( $self->{'min_time'} > $clocktime ) {
$self->{'min_time'} = $clocktime;
}
$self->{'total_time'} += $clocktime;
$self->{'total_time_time'} += $clocktime*$clocktime;
$self->{'number'}++;
$self->{'is_active'} = 0;
}
} |
sub push_stack
{ my ( $self, @args ) = @_;
if ( $self->{'is_active'} == 1 ) {
warning(
sprintf( "Attempting to push stack on tag '%s' "
. "when active. Discarding previous push."
. $self->tag() ) );
}
$self->{'current_start'} = time();
$self->{'is_active'} = 1; } |
sub tag
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'tag'} = $value }
return $self->{'tag'};
}
1; } |
sub total_time
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'total_time'} = $value }
return $self->{'total_time'}; } |
sub total_time_time
{ my ( $self, $value ) = @_;
if ( defined($value) ) { $self->{'total_time_time'} = $value }
return $self->{'total_time_time'}; } |
General documentation
Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
/info/about/code_licence.html