OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import signal | 7 import signal |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import time | 10 import time |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 def BoringCallers(mangled, use_re_wildcards): | 155 def BoringCallers(mangled, use_re_wildcards): |
156 """Return a list of 'boring' function names (optinally mangled) | 156 """Return a list of 'boring' function names (optinally mangled) |
157 with */? wildcards (optionally .*/.). | 157 with */? wildcards (optionally .*/.). |
158 Boring = we drop off the bottom of stack traces below such functions. | 158 Boring = we drop off the bottom of stack traces below such functions. |
159 """ | 159 """ |
160 | 160 |
161 need_mangling = [ | 161 need_mangling = [ |
162 # Don't show our testing framework: | 162 # Don't show our testing framework: |
163 ("testing::Test::Run", "_ZN7testing4Test3RunEv"), | 163 ("testing::Test::Run", "_ZN7testing4Test3RunEv"), |
164 ("testing::TestInfo::Run", "_ZN7testing8TestInfo3RunEv"), | 164 ("testing::TestInfo::Run", "_ZN7testing8TestInfo3RunEv"), |
165 ("testing::internal::Handle*ExceptionsInMethodIfSupported", | 165 ("testing::internal::Handle*ExceptionsInMethodIfSupported*", |
166 "_ZN7testing8internal3?Handle*ExceptionsInMethodIfSupported*"), | 166 "_ZN7testing8internal3?Handle*ExceptionsInMethodIfSupported*"), |
167 | 167 |
168 # Depend on scheduling: | 168 # Depend on scheduling: |
169 ("MessageLoop::Run", "_ZN11MessageLoop3RunEv"), | 169 ("MessageLoop::Run", "_ZN11MessageLoop3RunEv"), |
170 ("MessageLoop::RunTask", "_ZN11MessageLoop7RunTask*"), | 170 ("MessageLoop::RunTask", "_ZN11MessageLoop7RunTask*"), |
171 ("RunnableMethod*", "_ZN14RunnableMethod*"), | 171 ("RunnableMethod*", "_ZN14RunnableMethod*"), |
172 ("RunnableFunction*", "_ZN16RunnableFunction*"), | 172 ("RunnableFunction*", "_ZN16RunnableFunction*"), |
173 ("DispatchToMethod*", "_Z*16DispatchToMethod*"), | 173 ("DispatchToMethod*", "_Z*16DispatchToMethod*"), |
174 ("base::internal::Invoker*::DoInvoke*", | 174 ("base::internal::Invoker*::DoInvoke*", |
175 "_ZN4base8internal8Invoker*DoInvoke*"), # Invoker{1,2,3} | 175 "_ZN4base8internal8Invoker*DoInvoke*"), # Invoker{1,2,3} |
(...skipping 29 matching lines...) Expand all Loading... |
205 if sys.platform.startswith("cygwin"): | 205 if sys.platform.startswith("cygwin"): |
206 p = subprocess.Popen(["cygpath", "-m", path], | 206 p = subprocess.Popen(["cygpath", "-m", path], |
207 stdout=subprocess.PIPE, | 207 stdout=subprocess.PIPE, |
208 stderr=subprocess.PIPE) | 208 stderr=subprocess.PIPE) |
209 (out, err) = p.communicate() | 209 (out, err) = p.communicate() |
210 if err: | 210 if err: |
211 logging.warning("WARNING: cygpath error: %s", err) | 211 logging.warning("WARNING: cygpath error: %s", err) |
212 return out.strip() | 212 return out.strip() |
213 else: | 213 else: |
214 return path | 214 return path |
| 215 |
| 216 ############################ |
| 217 # Common output format code |
| 218 |
| 219 def PrintUsedSuppressionsList(suppcounts): |
| 220 """ Prints out the list of used suppressions in a format common to all the |
| 221 memory tools. If the list is empty, prints nothing and returns False, |
| 222 otherwise True. |
| 223 |
| 224 suppcounts: a dictionary of used suppression counts, |
| 225 Key -> name, Value -> count. |
| 226 """ |
| 227 if not suppcounts: |
| 228 return False |
| 229 |
| 230 print "-----------------------------------------------------" |
| 231 print "Suppressions used:" |
| 232 print " count name" |
| 233 for (name, count) in sorted(suppcounts.items(), key=lambda (k,v): (v,k)): |
| 234 print "%7d %s" % (count, name) |
| 235 print "-----------------------------------------------------" |
| 236 sys.stdout.flush() |
| 237 return True |
OLD | NEW |