Bio::EnsEMBL::Utils Eprof
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Utils::Eprof - Bespoke Ensembl profiler
Package variables
Privates (from "my" definitions)
$global;
Included modules
Bio::EnsEMBL::Utils::EprofStack
Bio::EnsEMBL::Utils::Exception ( ' throw ' )
Synopsis
  use Bio::EnsEMBL::Utils::Eprof( 'eprof_start', 'eprof_end',
'eprof_dump' );
&eprof_start('function-a'); # ... do something &eprof_end('function-a'); &eprof_dump( \*STDERR ); # there is an object based set for above as well, for running # multiple concurrent profilers
Description
This is an Ensembl profiler as we broke the Perl profilers.
Methods
_tagsDescriptionCode
dumpDescriptionCode
endDescriptionCode
eprof_dump
No description
Code
eprof_endDescriptionCode
eprof_resetDescriptionCode
eprof_startDescriptionCode
new
No description
Code
startDescriptionCode
Methods description
_tagscode    nextTop
 Title   : _tags
Usage : $obj->_tags($newval)
Function:
Returns : value of _tags
Args : newvalue (optional)
dumpcodeprevnextTop
 Title   : dump
Usage :
Function:
Example :
Returns :
Args :
endcodeprevnextTop
 Title   : end
Usage : $eprof->end('this_tag');
Function:
Example :
Returns :
Args :
eprof_endcodeprevnextTop
 Title   : eprof_end
Usage :
Function:
Example :
Returns :
Args :
eprof_resetcodeprevnextTop
 Title   : eprof_reset
Usage :
Function:
Example :
Returns :
Args :
eprof_startcodeprevnextTop
 Title   : eprof_start
Usage :
Function:
Example :
Returns :
Args :
startcodeprevnextTop
 Title   : start
Usage : $eprof->start('this_tag');
Function:
Example :
Returns :
Args :
Methods code
_tagsdescriptionprevnextTop
sub _tags {
  my ($obj) = @_;
  return $obj->{'_tags'};
}

1;
}
dumpdescriptionprevnextTop
sub dump {
  my ( $self, $fh ) = @_;

  my @tags = sort {
    $self->_tags()->{$a}->total_time()
      <=> $self->_tags()->{$b}->total_time()
  } keys %{ $self->_tags() };

  foreach my $tag (@tags) {
    my $st = $self->_tags->{$tag};

    if ( $st->number() == 0 ) { next }

    my $STD = '---';

    if ( $st->number() > 1 ) {
      my $SS =
        $st->total_time_time() -
        $st->total_time()*$st->total_time()/$st->number();
if ( $SS > 0 ) { $STD = sprintf( "%6f", sqrt( $SS/$st->number()/( $st->number() - 1 ) ) ); } } print( $fh sprintf( "Eprof: %20s %6f %6f %d %s [%6f,%6f]\n", $st->tag(), $st->total_time(), $st->total_time()/$st->number(), $st->number(),
$STD, $st->min_time(),
$st->max_time() ) );
} ## end foreach my $tag (@tags)
} ## end sub dump
}
enddescriptionprevnextTop
sub end {
  my ( $self, $tag ) = @_;

  if ( !defined($tag) ) {
    $self->throw("No tag, can't end.");
  }

  if ( !defined( $self->_tags()->{$tag} ) ) {
    $self->throw(
                sprintf( "Ending with a nonexistant tag '%s'", $tag ) );
  }

  $self->_tags->{$tag}->pop_stack();
}
eprof_dumpdescriptionprevnextTop
sub eprof_dump {
  my ($fh) = @_;

  if ( !defined($global) ) { return }

  $global->dump($fh);
}
eprof_enddescriptionprevnextTop
sub eprof_end {
  my ($tag) = @_;

  if ( !defined($global) ) {
    $global = Bio::EnsEMBL::Utils::Eprof->new();
  }

  $global->end($tag);
}
eprof_resetdescriptionprevnextTop
sub eprof_reset {
 undef($global)
}
eprof_startdescriptionprevnextTop
sub eprof_start {
  my ($tag) = @_;

  if ( !defined($global) ) {
    $global = Bio::EnsEMBL::Utils::Eprof->new();
  }

  $global->start($tag);
}
newdescriptionprevnextTop
sub new {
  my ($proto) = @_;

  my $class = ref($proto) || $proto;
  my $self = bless( { '_tags' => {} }, $class );

  return $self;
}
startdescriptionprevnextTop
sub start {
  my ( $self, $tag ) = @_;

  if ( !defined($tag) ) {
    $self->throw("No tag, can't start.");
  }

  if ( !defined( $self->_tags()->{$tag} ) ) {
    $self->_tags()->{$tag} = Bio::EnsEMBL::Utils::EprofStack->new($tag);
  }

  $self->_tags()->{$tag}->push_stack();
}
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>.