## Get the XML names ## sub GetXMLNames { open(INPUT, $inputPath); my @temp_xml = (); while () { chomp($_); # Look for title line if ($_ =~/Start -/) { my @sdk_line = split(/\t/, $_); push(@temp, substr($sdk_line[1], 18)); } } close INPUT; return @temp; } ## Get the Process time ## sub GetOnlyProcessTime{ open(LOG,">>$parseSDKPerfResultsLog"); open(INPUT, $inputPath); my @temp =(); while () { chomp($_); # find process time for that title if ($_ =~/Process/) { my @sdk_line = split(/\t/, $_); push(@temp , $sdk_line[2]); } } my $number = scalar(@temp); if($number < $Total_number_of_requests){ my $missing = $Total_number_of_requests - $number; print LOG "$missing request(s) in $inputPath have not got executed. Hence exiting.\n"; close LOG; close INPUT; exit; } close INPUT; return @temp; } ## Parse all the logs ## sub parseSDKPerfmonLogs{ open(LOG,">>$parseSDKPerfResultsLog"); for( my $su=1; $su <= $su_files; $su++){ $su_inputfile = "su".$su."_sdkperfmonlog.txt"; push(@su_inputfile,$su_inputfile); } for( my $mu=1; $mu <= $mu_files; $mu++){ $mu_inputfile = "mu".$mu."_sdkperfmonlog.txt"; push(@mu_inputfile,$mu_inputfile); } #############Get the Request file names in the first column ############# $inputPath=$ResFolderPath."\\su".$su_files."_sdkperfmonlog.txt"; @xml_names = GetXMLNames($inputPath); $Total_number_of_requests = @xml_names; ############# end of Get the request names in results file ########################## #############Get the SU process time ############# foreach $sufile (@su_inputfile){ #print $sufile; $inputPath=$ResFolderPath."\\".$sufile; $filenumber = substr($sufile,2,1); @temp = GetOnlyProcessTime($inputPath); if($filenumber <= $su_files){ if( $filenumber == 1){@su_first = @temp; } elsif($filenumber == 2){@su_second = @temp; } elsif($filenumber == 3){@su_third = @temp; } } } #############End of Get the SU process time ############# #############Get the MU process time ############# foreach $mufile (@mu_inputfile){ #print $sufile; $inputPath=$ResFolderPath."\\".$mufile; $filenumber = substr($mufile,2,1); @temp = GetOnlyProcessTime($inputPath); if($filenumber <= $mu_files){ if( $filenumber == 1){@mu_first = @temp; } elsif($filenumber == 2){@mu_second = @temp; } elsif($filenumber == 3){@mu_third = @temp; } } } #############End of Get the MU process time ############# #############Write everything to the output file ############# open(OUTPUT, ">>$outputFile") ; for(my $i = 0; $i < $Total_number_of_requests; $i++){ my $su_average = sprintf("%.3f", (($su_first[$i] + $su_second[$i] + $su_third[$i])/$su_files)); my $mu_average = sprintf("%.3f",(($mu_first[$i] + $mu_second[$i] + $mu_third[$i])/$mu_files)); print(OUTPUT "$xml_names[$i]\t$su_first[$i]\t$su_second[$i]\t$su_third[$i]\t$su_average\t$mu_first[$i]\t$mu_second[$i]\t$mu_third[$i]\t$mu_average \n"); } print LOG "All the values from performance logs are available in $outputFile \n "; close OUTPUT; #############End of Write everything to the output file ############# }