OLD | NEW |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
2 # | 5 # |
3 # Read a memtrace logfile from stdin and group memory allocations by logical | 6 # Read a memtrace logfile from stdin and group memory allocations by logical |
4 # code component. The code component is guessed from the callstack, and | 7 # code component. The code component is guessed from the callstack, and |
5 # is something like {v8, sqlite, disk cache, skia, etc..} | 8 # is something like {v8, sqlite, disk cache, skia, etc..} |
6 # | 9 # |
7 # Usage: | 10 # Usage: |
8 # | 11 # |
9 # summary.pl | 12 # summary.pl |
10 # | 13 # |
11 # [STDIN] -- The memwatcher.logXXXX file to summarize. | 14 # [STDIN] -- The memwatcher.logXXXX file to summarize. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 # Insert commas into an integer after each three digits for printing. | 147 # Insert commas into an integer after each three digits for printing. |
145 sub comma_print { | 148 sub comma_print { |
146 my $num = "$_[0]"; | 149 my $num = "$_[0]"; |
147 $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; | 150 $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; |
148 return $num; | 151 return $num; |
149 } | 152 } |
150 | 153 |
151 # ----- Main ------------------------------------------------ | 154 # ----- Main ------------------------------------------------ |
152 | 155 |
153 process_stdin(); | 156 process_stdin(); |
OLD | NEW |