Changeset 9fcaba3 for memlog_analyze
- Timestamp:
- 06/01/15 05:56:52 (10 years ago)
- Branches:
- master
- Children:
- 0109b01
- Parents:
- 3533094
- git-author:
- Hal Finkel <hfinkel@…> (06/01/15 05:56:52)
- git-committer:
- Hal Finkel <hfinkel@…> (06/01/15 05:56:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
memlog_analyze
r3533094 r9fcaba3 4 4 use Getopt::Long; 5 5 6 my $find_leaks = 0; 6 7 my $print_raw_proc_name = 0; 7 8 my $quiet = 0; … … 13 14 Usage: $0 [options] <memlog file> [<output directory>] 14 15 options: 16 --leaks 17 Provide information on leaks instead of peak usage 15 18 --print-symbol-names 16 19 Include symbol names and offsets in the output … … 24 27 25 28 GetOptions("help|h|?" => \$help, 29 "leaks" => \$find_leaks, 26 30 "print-symbol-names" => \$print_raw_proc_name, 27 31 "quiet|q" => \$quiet) … … 69 73 # Scan the log for malloc/free pairings. We're interested only in active 70 74 # allocations at the time when the rss reaches the final maxrss. 71 my $max_rss_time = 0; 75 # If we're finding leaks, then go to the very end. 76 my $active_alloc_time = 0; 72 77 my %malloc_lines; 73 78 foreach my $line (<MEMLOG>) { … … 88 93 } 89 94 90 # If we've reached the max rss, we've seen all we need to see.91 95 my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 92 $max_rss_time = $time; 93 if ($then_max_rss == $max_rss) { 94 last; 96 $active_alloc_time = $time; 97 98 if (!$find_leaks) { 99 # If we've reached the max rss, we've seen all we need to see. 100 if ($then_max_rss == $max_rss) { 101 last; 102 } 95 103 } 96 104 } … … 207 215 print DOT ("node [width=0.375,height=0.25];\n"); 208 216 217 my $find_type = $find_leaks ? " (leaks)" : ""; 209 218 printf DOT ("Legend [shape=box, fontsize=100, shape=oval," . 210 "label=\"Total: %s active at maxrss = %s after %s s\"];\n", 211 format_bytes($total_size), format_bytes($max_rss), $max_rss_time); 212 213 printf TXT ("memlog: Total: %s active at maxrss = %s after %s s\n\n", 214 format_bytes($total_size), format_bytes($max_rss), $max_rss_time); 219 "label=\"Total: %s active$find_type at maxrss = %s after %s s\"];\n", 220 format_bytes($total_size), format_bytes($max_rss), 221 $active_alloc_time); 222 223 printf TXT ("memlog: Total: %s active$find_type at maxrss = %s after %s s\n\n", 224 format_bytes($total_size), format_bytes($max_rss), 225 $active_alloc_time); 215 226 216 227 my %cached_names;
Note: See TracChangeset
for help on using the changeset viewer.