Changeset 21d3542 for memlog_analyze
- Timestamp:
- 06/02/15 16:50:48 (9 years ago)
- Branches:
- master
- Children:
- 6444e03
- Parents:
- 192a260
- git-author:
- Hal Finkel <hfinkel@…> (06/02/15 16:50:48)
- git-committer:
- Hal Finkel <hfinkel@…> (06/02/15 16:50:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
memlog_analyze
rc83befc r21d3542 64 64 my $state = shift(@parts); 65 65 66 my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 66 my ($time, $then_max_rss, $tid, $then_arena, $then_mmap) = 67 split(/\s+/, $state); 67 68 if ($pot_max_rss < $then_max_rss) { 68 69 $pot_max_rss = $then_max_rss; … … 94 95 # The first step is to determine the high-water mark. 95 96 my $max_rss = 0; 97 my $arena = 0; 98 my $mmap = 0; 96 99 foreach my $line (<MEMLOG>) { 97 100 chomp($line); … … 101 104 my $state = shift(@parts); 102 105 103 my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 106 my ($time, $then_max_rss, $tid, $then_arena, $then_mmap) = 107 split(/\s+/, $state); 104 108 if ($max_rss < $then_max_rss) { 105 109 $max_rss = $then_max_rss; 110 $arena = $then_arena; 111 $mmap = $then_mmap; 106 112 } 107 113 } … … 131 137 } 132 138 133 my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 139 my ($time, $then_max_rss, $tid, $then_arena, $then_mmap) = 140 split(/\s+/, $state); 134 141 $active_alloc_time = $time; 135 142 … … 146 153 # Convert maxrss, currently in KB, to bytes. 147 154 $max_rss *= 1024; 155 if (defined $arena) { 156 $arena *= 1024; 157 } 158 if (defined $mmap) { 159 $mmap *= 1024; 160 } 148 161 149 162 my $total_size = 0; … … 162 175 163 176 my ($size, $ptr) = ($op =~ /^M: (\d+) 0x(\w+)/); 164 my ($time, $then_max_rss, $tid) = split(/\s+/, $state); 177 my ($time, $then_max_rss, $tid, $then_arena, $then_mmap) = 178 split(/\s+/, $state); 165 179 166 180 $total_size += $size; … … 249 263 } 250 264 265 sub format_bytes_or_unk($) { 266 my $b = $_[0]; 267 return defined($b) ? format_bytes($b) : "(unknown)"; 268 } 269 251 270 print DOT ("digraph \"memlog\" {\n"); 252 271 print DOT ("size=\"8,11\";\n"); … … 254 273 255 274 my $find_type = $find_leaks ? " (leaks)" : ""; 256 printf DOT ("Legend [shape=box, fontsize=100, shape=oval," . 257 "label=\"Total: %s active$find_type at maxrss = %s after %s s\"];\n", 275 print DOT "subgraph cluster_key {\n"; 276 print DOT "\trank=min;\n"; 277 print DOT "\tlabel=\"memlog\";\n"; 278 print DOT "\tfontsize=100;\n"; 279 print DOT "\trankdir=UR;\n"; 280 printf DOT ("Legend [shape=box, fontsize=100, shape=plaintext," . 281 "label=\"Total: %s active$find_type at maxrss = %s after %s s\\narena: %s\\nmmap: %s\"];\n", 258 282 format_bytes($total_size), format_bytes($max_rss), 259 $active_alloc_time); 260 261 printf TXT ("memlog: Total: %s active$find_type at maxrss = %s after %s s\n\n", 283 $active_alloc_time, format_bytes_or_unk($arena), 284 format_bytes_or_unk($mmap)); 285 print DOT "}\n"; 286 287 printf TXT ("memlog: Total: %s active$find_type at maxrss = %s after %s s\n\tarena: %s\tmmap: %s\n\n", 262 288 format_bytes($total_size), format_bytes($max_rss), 263 $active_alloc_time); 289 $active_alloc_time, format_bytes_or_unk($arena), 290 format_bytes_or_unk($mmap)); 264 291 265 292 my %cached_names;
Note: See TracChangeset
for help on using the changeset viewer.