3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
33 Bio::EnsEMBL::Util::EprofStack - DESCRIPTION of Object
43 package Bio::EnsEMBL::Utils::EprofStack;
55 Time::HiRes->import(
'time');
60 my ( $proto, $name ) = @_;
62 my $class = ref($proto) || $proto;
64 my $self = bless( {
'is_active' => 0,
66 'total_time_time' => 0,
68 'min_time' => 999999999,
90 my ( $self, @args ) = @_;
92 if ( $self->{
'is_active'} == 1 ) {
94 sprintf(
"Attempting to push stack on tag '%s' "
95 .
"when active. Discarding previous push."
99 # my ( $user, $sys ) = times();
100 # $self->{'current_start'} = (POSIX::times)[0];
102 $self->{
'current_start'} = time();
103 $self->{
'is_active'} = 1;
119 my ( $self, @args ) = @_;
121 if ( $self->{
'is_active'} == 0 ) {
123 sprintf(
"Attempting to pop stack on tag '%s' "
124 .
"when not active. Ignoring.",
128 # my ( $user, $sys ) = times();
130 # ( (POSIX::times)[0] - $self->{'current_start'} )/
131 # POSIX::sysconf(&POSIX::_SC_CLK_TCK);
133 my $clocktime = time() - $self->{
'current_start'};
135 if ( $self->{
'max_time'} < $clocktime ) {
136 $self->{
'max_time'} = $clocktime;
138 if ( $self->{
'min_time'} > $clocktime ) {
139 $self->{
'min_time'} = $clocktime;
142 $self->{
'total_time'} += $clocktime;
143 $self->{
'total_time_time'} += $clocktime*$clocktime;
145 $self->{
'is_active'} = 0;
146 } ## end sub pop_stack
148 =head2 total_time_time
150 Title : total_time_time
151 Usage : $obj->total_time_time($newval)
153 Returns : value of total_time_time
154 Args : newvalue (optional)
159 sub total_time_time {
160 my ( $self, $value ) = @_;
162 if ( defined($value) ) { $self->{
'total_time_time'} = $value }
164 return $self->{
'total_time_time'};
170 Usage : $obj->max_time($newval)
172 Returns : value of max_time
173 Args : newvalue (optional)
179 my ( $self, $value ) = @_;
181 if ( defined($value) ) { $self->{
'max_time'} = $value }
183 return $self->{
'max_time'};
189 Usage : $obj->min_time($newval)
191 Returns : value of min_time
192 Args : newvalue (optional)
198 my ( $self, $value ) = @_;
200 if ( defined($value) ) { $self->{
'min_time'} = $value }
202 return $self->{
'min_time'};
208 Usage : $obj->total_time($newval)
210 Returns : value of total_time
211 Args : newvalue (optional)
217 my ( $self, $value ) = @_;
219 if ( defined($value) ) { $self->{
'total_time'} = $value }
221 return $self->{
'total_time'};
227 Usage : $obj->number($newval)
229 Returns : value of number
230 Args : newvalue (optional)
236 my ( $self, $value ) = @_;
238 if ( defined($value) ) { $self->{
'number'} = $value }
240 return $self->{
'number'};
246 Usage : $obj->is_active($newval)
248 Returns : value of is_active
249 Args : newvalue (optional)
255 my ( $self, $value ) = @_;
257 if ( defined($value) ) { $self->{
'is_active'} = $value }
259 return $self->{
'is_active'};
264 Title : current_start
265 Usage : $obj->current_start($newval)
267 Returns : value of current_start
268 Args : newvalue (optional)
274 my ( $self, $value ) = @_;
276 if ( defined($value) ) { $self->{
'current_start'} = $value }
278 return $self->{
'current_start'};
284 Usage : $obj->tag($newval)
286 Returns : value of tag
287 Args : newvalue (optional)
293 my ( $self, $value ) = @_;
295 if ( defined($value) ) { $self->{
'tag'} = $value }
297 return $self->{
'tag'};