<commit_before>
#
# BioPerl module for Bio::EnsEMBL::Util::EprofStack
#
# Cared for by <NAME> <<EMAIL>>
#
# Copyright <NAME>
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::EnsEMBL::Util::EprofStack - DESCRIPTION of Object

=head1 SYNOPSIS

Give standard usage here

=head1 DESCRIPTION

Describe the object here

=head1 CONTACT

Describe contact details here

=head1 APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

=cut


# Let the code begin...


package Bio::EnsEMBL::Utils::EprofStack;
use vars qw(@ISA);
use POSIX;
use strict;

# Object preamble - inheriets from Bio::Root::Object

use Bio::EnsEMBL::Root;
BEGIN {
 eval {
 require Time::HiRes;
 Time::HiRes->import('time');
 };
};

@ISA = qw(Bio::EnsEMBL::Root);


sub new { 
    my ($class,$name) = @_;
    my $self = {
       'is_active'       => 0,
       'total_time'      => 0,
       'total_time_time' => 0,
       'max_time'        => 0, 
       'min_time'        => 999999999,
       'number'          => 0,
       'tag'             => $name
    };
    bless $self,$class;
    return $self;
}

=head2 push_stack

 Title   : push_stack
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub push_stack{
   my ($self,@args) = @_;

   if( $self->{'is_active'} == 1 ) {
       $self->warn("Attempting to push stack on tag ".$self->tag." when active. Discarding previous push");
   }
   #my($user,$sys) = times();
   # $self->{'current_start'} = (POSIX::times)[0];
   $self->{'current_start'} = time();
   $self->{'is_active'}=1
}

=head2 pop_stack

 Title   : pop_stack
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub pop_stack{
   my ($self,@args) = @_;

   if( $self->{'is_active'} == 0 ) {
       $self->warn("Attempting to push stack on tag ",$self->tag," when not active. Ignoring");
   }
   #my($user,$sys) = times();
 #  my $clocktime = ( (POSIX::times)[0] - $self->{'current_start'} ) / POSIX::sysconf(&POSIX::_SC_CLK_TCK);
   my $clocktime = time() - $self->{'current_start'};
   $self->{'max_time'} = $clocktime if $self->{'max_time'} < $clocktime;<commit_msg>Remove inheritance from Bio::EnsEMBL::Root Use warning() from Bio::EnsEBML::Utils::Exception instead of warn() from Bio::EnsEMBL::Root. Fix warning message in pop_stack()<commit_after>
#
# BioPerl module for Bio::EnsEMBL::Util::EprofStack
#
# Cared for by <NAME> <<EMAIL>>
#
# Copyright <NAME>
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::EnsEMBL::Util::EprofStack - DESCRIPTION of Object

=head1 SYNOPSIS

Give standard usage here

=head1 DESCRIPTION

Describe the object here

=head1 CONTACT

Describe contact details here

=head1 APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

=cut


# Let the code begin...


package Bio::EnsEMBL::Utils::EprofStack;

use POSIX;
use strict;


use Bio::EnsEMBL::Utils::Exception qw(warning);
BEGIN {
 eval {
 require Time::HiRes;
 Time::HiRes->import('time');
 };
};


sub new { 
    my ($class,$name) = @_;
    my $self = {
       'is_active'       => 0,
       'total_time'      => 0,
       'total_time_time' => 0,
       'max_time'        => 0, 
       'min_time'        => 999999999,
       'number'          => 0,
       'tag'             => $name
    };
    bless $self,$class;
    return $self;
}

=head2 push_stack

 Title   : push_stack
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub push_stack{
   my ($self,@args) = @_;

   if( $self->{'is_active'} == 1 ) {
       warning("Attempting to push stack on tag ".$self->tag." when active. Discarding previous push");
   }
   #my($user,$sys) = times();
   # $self->{'current_start'} = (POSIX::times)[0];
   $self->{'current_start'} = time();
   $self->{'is_active'}=1
}

=head2 pop_stack

 Title   : pop_stack
 Usage   :
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub pop_stack{
   my ($self,@args) = @_;

   if( $self->{'is_active'} == 0 ) {
       warning("Attempting to pop stack on tag ".$self->tag." when not active. Ignoring");
   }
   #my($user,$sys) = times();
 #  my $clocktime = ( (POSIX::times)[0] - $self->{'current_start'} ) / POSIX::sysconf(&POSIX::_SC_CLK_TCK);
   my $clocktime = time() - $self->{'current_start'};
   $self->{'max_time'} = $clocktime if $self->{'max_time'} < $clocktime;
{'fraction_non_alphanumeric': 0.1591160220994475, 'fraction_numerical': 0.01149171270718232, 'mean_word_length': 3.1446886446886446, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801420', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1572, 'n_words': 421}