Changeset 20b45de for memlog2dot
- Timestamp:
- 05/29/15 19:05:23 (10 years ago)
- Branches:
- master
- Children:
- 24aa734
- Parents:
- 510af01
- git-author:
- Hal Finkel <hfinkel@…> (05/29/15 19:05:23)
- git-committer:
- Hal Finkel <hfinkel@…> (05/29/15 19:05:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
memlog2dot
r1bd82e0 r20b45de 147 147 } 148 148 149 my $txt_fn = "$out_dir/" . basename($memlog_fn) . ".txt"; 149 150 my $dot_fn = "$out_dir/" . basename($memlog_fn) . ".dot"; 150 151 my $ps_fn = "$out_dir/" . basename($memlog_fn) . ".ps"; 151 152 my $pdf_fn = "$out_dir/" . basename($memlog_fn) . ".pdf"; 152 153 154 open(TXT, ">$txt_fn") || die "Can't open $txt_fn: $!"; 153 155 open(DOT, ">$dot_fn") || die "Can't open $dot_fn: $!"; 154 156 … … 172 174 printf DOT ("Legend [shape=box, fontsize=100, shape=oval," . 173 175 "label=\"Total: %s active at maxrss = %s after %s s\"];\n", 176 format_bytes($total_size), format_bytes($max_rss), $max_rss_time); 177 178 printf TXT ("memlog: Total: %s active at maxrss = %s after %s s\n\n", 174 179 format_bytes($total_size), format_bytes($max_rss), $max_rss_time); 175 180 … … 247 252 foreach my $pc (keys %all_nodes) { 248 253 my $node = $all_nodes{$pc}; 249 my $name = get_name($node);250 254 251 255 my $local_size = $node->{'size'}; … … 260 264 } 261 265 266 my $name = get_name($node); 267 262 268 printf DOT ("N%s [label=\"%s\\n%s\", shape=box, fontsize=%.1f%s];\n", 263 269 $pc, $name, format_bytes($local_size), $fs); … … 265 271 266 272 foreach my $pc (keys %all_nodes) { 273 if ($skipped{$pc}) { 274 next; 275 } 276 267 277 my $node = $all_nodes{$pc}; 268 269 278 my $local_size = $node->{'size'}; 270 if ($skipped{$pc}) {271 next;272 }273 279 274 280 foreach my $cpc (keys %{$node->{'child_sizes'}}) { … … 292 298 print DOT ("}\n"); 293 299 300 foreach my $pc (sort { $all_nodes{$::b}->{'size'} <=> 301 $all_nodes{$::a}->{'size'} } keys %all_nodes) { 302 if ($skipped{$pc}) { 303 next; 304 } 305 306 print TXT ('*' x 80) . "\n\n"; 307 308 my $node = $all_nodes{$pc}; 309 310 my $local_size = $node->{'size'}; 311 printf TXT ("%s - %.1f%%\n", format_bytes($local_size), 312 $local_size * 100.0 / $total_size); 313 314 my $name = get_name($node); 315 $name =~ s/\\n/\n/g; 316 317 print TXT "$name\n$pc\n"; 318 319 print TXT "\nMEMORY ALLOCATED BY CALLEES:\n"; 320 321 foreach my $cpc (sort { $node->{'child_sizes'}->{$::b} <=> 322 $node->{'child_sizes'}->{$::a} } 323 keys %{$node->{'child_sizes'}}) { 324 if ($skipped{$cpc}) { 325 next; 326 } 327 328 my $child_node = $all_nodes{$cpc}; 329 my $child_size = $node->{'child_sizes'}->{$cpc}; 330 331 printf TXT ("\t%s - %.1f%%\n", format_bytes($child_size), 332 $child_size * 100.0 / $local_size); 333 334 my $child_name = get_name($child_node); 335 $child_name =~ s/\\n/\n\t/g; 336 print TXT "\t$child_name\n\t$cpc\n"; 337 338 print TXT "\n"; 339 } 340 341 print TXT "\n"; 342 } 343 344 close(TXT); 294 345 close(DOT); 295 346
Note: See TracChangeset
for help on using the changeset viewer.