Changeset 5df7203


Ignore:
Timestamp:
06/01/15 06:25:13 (9 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master
Children:
d270799
Parents:
0109b01
git-author:
Hal Finkel <hfinkel@…> (06/01/15 06:25:13)
git-committer:
Hal Finkel <hfinkel@…> (06/01/15 06:25:13)
Message:

add glob processing

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • README

    r0109b01 r5df7203  
    4040when the peak memory usage is first reached. 
    4141 
     42You might have many runs of the same application (or output from many ranks of 
     43an MPI job), and you'd like to pick the one for analysis with the highest 
     44memory usage. If you provide a glob pattern to memlog_analyze it will do this 
     45for you. Make sure you quote the glob pattern so that your shell does not 
     46expand it. 
     47 
     48  /path/to/memlog/memlog_analyze "/path/to/*.memlog" 
     49 
    4250When running under common batch systems, the files are named 
    4351JOB_ID.HOST.PID.memlog, and when running under the BG/Q CNK, the process's rank 
  • memlog_analyze

    r9fcaba3 r5df7203  
    1212  my $ec = $_[0]; 
    1313  my $usage = <<EOM; 
    14 Usage: $0 [options] <memlog file> [<output directory>] 
     14Usage: $0 [options] <memlog file or glob> [<output directory>] 
    1515  options: 
    1616    --leaks 
     
    4040 
    4141if (! -f $memlog_fn) { 
     42  my @pot_fns = glob($memlog_fn); 
     43  if (scalar(@pot_fns)) { 
     44    if (!$quiet) { 
     45      print "Searching all files matching '$memlog_fn'\n"; 
     46    } 
     47 
     48    my $pot_max_rss = 0; 
     49    my $pos_max_rss_fn; 
     50    foreach my $pot_fn (@pot_fns) { 
     51      my $last_line = `tail -n 1 '$pot_fn'`; 
     52      chomp($last_line); 
     53 
     54      my @parts = split(/\t/, $last_line); 
     55 
     56      my $op = shift(@parts); 
     57      my $state = shift(@parts); 
     58 
     59      my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 
     60      if ($pot_max_rss < $then_max_rss) { 
     61        $pot_max_rss = $then_max_rss; 
     62        $pos_max_rss_fn = $pot_fn; 
     63      } 
     64    } 
     65 
     66    if (defined $pos_max_rss_fn) { 
     67      $memlog_fn = $pos_max_rss_fn; 
     68      goto have_memlog_fn; 
     69    } 
     70  } 
     71 
    4272  print_usage(1); 
    4373} 
     74have_memlog_fn: 
    4475 
    4576# The version of addr2line and friends that you use can make a big difference, 
Note: See TracChangeset for help on using the changeset viewer.