Created
June 19, 2023 14:03
-
-
Save earnhardt3rd/c077b0a5441c98a18dd56e2a95af7f49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'getopts.pl'; | |
| Getopts('m:d:t'); | |
| my $MODE = uc($opt_m) || ""; | |
| my $DEBUG = $opt_d || 0; | |
| if (defined $opt_t) { my %TEST = &_SEARCH_ISSUE_STATS();} | |
| 1; | |
| sub _SEARCH_ISSUE_STATS { | |
| my $searchFor = shift || "mem"; | |
| my $iss_root = $OS_FOLDERS{"ISS"}; | |
| if (! -d $iss_root) { | |
| print " Unable to locate 'Issue Root' folder: $iss_root\n"; | |
| return; | |
| } | |
| my @D_LIST = &getDIR_ARRAY("Choose Issue Folders to Search",$iss_root); | |
| if (scalar(@D_LIST) > 0) { | |
| my %TASK_MEM; | |
| for (my $di=0;$di<=scalar(@D_LIST)-1 ;$di++) { | |
| print "$di. $D_LIST[$di]\n"; | |
| my $folder=$iss_root . $SLASH . $D_LIST[$di]; | |
| opendir(FP,$folder); | |
| #@D = grep !/\.\.?$/, readdir(LP); | |
| my $PREFIX="getstats.tar.gz"; | |
| my @F = grep { /${PREFIX}$/ } readdir(FP); | |
| closedir(FP); | |
| my @F_LIST = @F; | |
| for (my $fi=0;$fi<=scalar(@F_LIST)-1 ;$fi++) { | |
| my $file = $F_LIST[$fi]; | |
| my @FP = split('-',$file); | |
| my $f_dt = $FP[0]; | |
| my $f_tm = $FP[1]; | |
| my $f_h = ""; | |
| for (my $i=2;$i<=scalar(@FP)-1 ;$i++) { | |
| if ($FP[$i] !~ /getstats/) { | |
| if ($f_h eq "") { | |
| $f_h=$FP[$i]; | |
| } else { | |
| $f_h.="-" . $FP[$i]; | |
| } | |
| } | |
| } | |
| my $e_folder = $folder . $SLASH . $f_tm; | |
| print " --$fi. $f_dt : $f_tm : $f_h\n"; | |
| my $e_name = &unPak($folder,$file,$e_folder); | |
| my $t_file = $e_folder . $SLASH . $f_dt . "-" . $f_tm . "-" . $f_h . "-tasklist-v.csv"; | |
| my %TASKS = &taskList($f_dt . "," . $f_tm,$t_file); | |
| foreach my $tKey(sort keys %TASKS) { | |
| if (! exists($TASK_MEM{$tKey})) {$TASK_MEM{$tKey}="";} | |
| if ($TASK_MEM{$tKey} eq "") { | |
| $TASK_MEM{$tKey}=$TASKS{$tKey}; | |
| } else { | |
| if ($TASK_MEM{$tKey} < $TASKS{$tKey}) { | |
| $TASK_MEM{$tKey}=$TASKS{$tKey}; | |
| } | |
| } | |
| } | |
| &removeTempFolder($e_folder); | |
| } | |
| my $rpt = $ENV{"PDM"} . $SLASH . ".temp" . $SLASH . "$DT-$TM-memory\.csv"; | |
| open(FH,"> $rpt"); | |
| print FH "DATE,TIME,PROCESS,ID,MEMORY\n"; | |
| foreach my $key(sort keys %TASK_MEM) { | |
| print FH "$key,$TASK_MEM{$key}\n"; | |
| } | |
| close(FH); | |
| print "See $rpt\n"; | |
| } | |
| } else { | |
| print " Nothing to process!\n"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment