I have written a following perl script to read particular entities from a text file and avg their timestamp.( I have attached this code as perfresult.txt)
Expand|Select|Wrap|Line Numbers
- use strict;
- my %retrieve;
- my $count = 0;
- my $file1 = 'a1.txt';
- open (R, $file1) or die ("Could not open $file1!");
- while (<R>) {
- next unless /^*Retrieve_generic_/ ||
- /^*Retrieve_assembly_1_/ ||
- /^*Retrieve_assembly_2_/ ||
- /^*300_wireframe_view_/ ||
- /^*80_wireframe_view_/ ||
- /^*3_hidden_view_/ ||
- /^*Fast_HLR_/ ||
- /^*120_hidden_view_/ ||
- /^*shaded_view_/ ||
- /^*shaded_mouse_/ ||
- /^*realtime_rendered_/;
- $count++;
- my ( $retrieve, $time ) = split;
- my ( $h, $m, $s ) = split ':', $time;
- $retrieve{$retrieve} += $h * 3600 + $m * 60 + $s;
- }
- close(R);
- for my $retrieve ( keys %retrieve ) {
- my $hms = secondsToHMS($retrieve{$retrieve} / (
- 3));
- print "$retrieve\t$hms\n" if defined $hms;
- }
- # For seconds < 86400, else undef returned
- sub secondsToHMS {
- my $seconds = $_[0];
- return undef if $seconds >= 86400;
- my $h = int $seconds / 3600;
- my $m = int( $seconds - $h * 3600 ) / 60;
- my $s = $seconds % 60;
- return sprintf( '%02d:%02d:%02d', $h, $m, $s );
- }
simultaneously and compare the entities to get the
timestamp difference.(I have attached result.txt for
the output format)
- Please help me to modify my code to get desired output.