Bio::EnsEMBL::Utils EprofStack
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Util::EprofStack - DESCRIPTION of Object
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Utils::Exception ( ' warning ' )
POSIX
Synopsis
Description
Methods
BEGIN Code
current_startDescriptionCode
is_activeDescriptionCode
max_timeDescriptionCode
min_timeDescriptionCode
new
No description
Code
numberDescriptionCode
pop_stackDescriptionCode
push_stackDescriptionCode
tagDescriptionCode
total_timeDescriptionCode
total_time_timeDescriptionCode
Methods description
current_startcode    nextTop
 Title   : current_start
Usage : $obj->current_start($newval)
Function:
Returns : value of current_start
Args : newvalue (optional)
is_activecodeprevnextTop
 Title   : is_active
Usage : $obj->is_active($newval)
Function:
Returns : value of is_active
Args : newvalue (optional)
max_timecodeprevnextTop
 Title   : max_time
Usage : $obj->max_time($newval)
Function:
Returns : value of max_time
Args : newvalue (optional)
min_timecodeprevnextTop
 Title   : min_time
Usage : $obj->min_time($newval)
Function:
Returns : value of min_time
Args : newvalue (optional)
numbercodeprevnextTop
 Title   : number
Usage : $obj->number($newval)
Function:
Returns : value of number
Args : newvalue (optional)
pop_stackcodeprevnextTop
 Title   : pop_stack
Usage :
Function:
Example :
Returns :
Args :
push_stackcodeprevnextTop
 Title   : push_stack
Usage :
Function:
Example :
Returns :
Args :
tagcodeprevnextTop
 Title   : tag
Usage : $obj->tag($newval)
Function:
Returns : value of tag
Args : newvalue (optional)
total_timecodeprevnextTop
 Title   : total_time
Usage : $obj->total_time($newval)
Function:
Returns : value of total_time
Args : newvalue (optional)
total_time_timecodeprevnextTop
 Title   : total_time_time
Usage : $obj->total_time_time($newval)
Function:
Returns : value of total_time_time
Args : newvalue (optional)
Methods code
BEGINTop
BEGIN {
  eval {
    require Time::HiRes;
    Time::HiRes->import('time');
  };
}
current_startdescriptionprevnextTop
sub current_start {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'current_start'} = $value }

  return $self->{'current_start'};
}
is_activedescriptionprevnextTop
sub is_active {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'is_active'} = $value }

  return $self->{'is_active'};
}
max_timedescriptionprevnextTop
sub max_time {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'max_time'} = $value }

  return $self->{'max_time'};
}
min_timedescriptionprevnextTop
sub min_time {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'min_time'} = $value }

  return $self->{'min_time'};
}
newdescriptionprevnextTop
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;
}
numberdescriptionprevnextTop
sub number {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'number'} = $value }

  return $self->{'number'};
}
pop_stackdescriptionprevnextTop
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 ( $user, $sys ) = times();
# my $clocktime =
# ( (POSIX::times)[0] - $self->{'current_start'} )/
# POSIX::sysconf(&POSIX::_SC_CLK_TCK);
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; } ## end sub pop_stack
}
push_stackdescriptionprevnextTop
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() ) );
  }

  # my ( $user, $sys ) = times();
# $self->{'current_start'} = (POSIX::times)[0];
$self->{'current_start'} = time(); $self->{'is_active'} = 1;
}
tagdescriptionprevnextTop
sub tag {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'tag'} = $value }

  return $self->{'tag'};
}

1;
}
total_timedescriptionprevnextTop
sub total_time {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'total_time'} = $value }

  return $self->{'total_time'};
}
total_time_timedescriptionprevnextTop
sub total_time_time {
  my ( $self, $value ) = @_;

  if ( defined($value) ) { $self->{'total_time_time'} = $value }

  return $self->{'total_time_time'};
}
General documentation
LICENSETop
  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
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.