| OLD | NEW |
| 1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 # 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 |
| 7 # code component. The code component is guessed from the callstack, and | 7 # code component. The code component is guessed from the callstack, and |
| 8 # is something like {v8, sqlite, disk cache, skia, etc..} | 8 # is something like {v8, sqlite, disk cache, skia, etc..} |
| 9 # | 9 # |
| 10 # Usage: | 10 # Usage: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } elsif ($loc =~ m/safe_browsing/) { | 107 } elsif ($loc =~ m/safe_browsing/) { |
| 108 $location_blame = "safe_browsing"; | 108 $location_blame = "safe_browsing"; |
| 109 } elsif ($loc =~ m/VisitedLinkMaster/) { | 109 } elsif ($loc =~ m/VisitedLinkMaster/) { |
| 110 $location_blame = "VisitedLinkMaster"; | 110 $location_blame = "VisitedLinkMaster"; |
| 111 } elsif ($loc =~ m/NewDOMUI/) { | 111 } elsif ($loc =~ m/NewDOMUI/) { |
| 112 $location_blame = "NewDOMUI"; | 112 $location_blame = "NewDOMUI"; |
| 113 } elsif ($loc =~ m/RegistryControlledDomainService/) { | 113 } elsif ($loc =~ m/RegistryControlledDomainService/) { |
| 114 $location_blame = "RegistryControlledDomainService"; | 114 $location_blame = "RegistryControlledDomainService"; |
| 115 } elsif ($loc =~ m/URLRequestChromeJob::DataAvailable/) { | 115 } elsif ($loc =~ m/URLRequestChromeJob::DataAvailable/) { |
| 116 $location_blame = "URLRequestChromeJob DataAvailable"; | 116 $location_blame = "URLRequestChromeJob DataAvailable"; |
| 117 } elsif ($loc =~ m/history_publisher/) { | |
| 118 $location_blame = "history publisher"; | |
| 119 } else { | 117 } else { |
| 120 $location_blame = "unknown"; | 118 $location_blame = "unknown"; |
| 121 } | 119 } |
| 122 | 120 |
| 123 # Surface large outliers in an "interesting" group. | 121 # Surface large outliers in an "interesting" group. |
| 124 my $interesting_group = "unknown"; | 122 my $interesting_group = "unknown"; |
| 125 my $interesting_size = 10000000; # Make this smaller as needed. | 123 my $interesting_size = 10000000; # Make this smaller as needed. |
| 126 # TODO(jar): Add this as a pair of shell arguments. | 124 # TODO(jar): Add this as a pair of shell arguments. |
| 127 if ($bytes > $interesting_size && $location_blame eq $interesting_group) { | 125 if ($bytes > $interesting_size && $location_blame eq $interesting_group) { |
| 128 # Create a special group for the exact stack that contributed so much. | 126 # Create a special group for the exact stack that contributed so much. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 147 # Insert commas into an integer after each three digits for printing. | 145 # Insert commas into an integer after each three digits for printing. |
| 148 sub comma_print { | 146 sub comma_print { |
| 149 my $num = "$_[0]"; | 147 my $num = "$_[0]"; |
| 150 $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; | 148 $num =~ s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; |
| 151 return $num; | 149 return $num; |
| 152 } | 150 } |
| 153 | 151 |
| 154 # ----- Main ------------------------------------------------ | 152 # ----- Main ------------------------------------------------ |
| 155 | 153 |
| 156 process_stdin(); | 154 process_stdin(); |
| OLD | NEW |