OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Find the most recent tombstone file(s) on all connected devices | 7 # Find the most recent tombstone file(s) on all connected devices |
8 # and prints their stacks. | 8 # and prints their stacks. |
9 # | 9 # |
10 # Assumes tombstone file was created with current symbols. | 10 # Assumes tombstone file was created with current symbols. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 """Resolve a list of tombstones. | 150 """Resolve a list of tombstones. |
151 | 151 |
152 Args: | 152 Args: |
153 jobs: the number of jobs to use with multiprocess. | 153 jobs: the number of jobs to use with multiprocess. |
154 tombstones: a list of tombstones. | 154 tombstones: a list of tombstones. |
155 """ | 155 """ |
156 if not tombstones: | 156 if not tombstones: |
157 logging.warning('No tombstones to resolve.') | 157 logging.warning('No tombstones to resolve.') |
158 return | 158 return |
159 if len(tombstones) == 1: | 159 if len(tombstones) == 1: |
160 data = _ResolveTombstone(tombstones[0]) | 160 data = [_ResolveTombstone(tombstones[0])] |
161 else: | 161 else: |
162 pool = multiprocessing.Pool(processes=jobs) | 162 pool = multiprocessing.Pool(processes=jobs) |
163 data = pool.map(_ResolveTombstone, tombstones) | 163 data = pool.map(_ResolveTombstone, tombstones) |
164 for d in data: | 164 for tombstone in data: |
165 logging.info(d) | 165 for line in tombstone: |
| 166 logging.info(line) |
166 | 167 |
167 | 168 |
168 def _GetTombstonesForDevice(device, options): | 169 def _GetTombstonesForDevice(device, options): |
169 """Returns a list of tombstones on a given device. | 170 """Returns a list of tombstones on a given device. |
170 | 171 |
171 Args: | 172 Args: |
172 device: An instance of DeviceUtils. | 173 device: An instance of DeviceUtils. |
173 options: command line arguments from OptParse | 174 options: command line arguments from OptParse |
174 """ | 175 """ |
175 ret = [] | 176 ret = [] |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 # http://bugs.python.org/issue7980 | 243 # http://bugs.python.org/issue7980 |
243 tombstones = [] | 244 tombstones = [] |
244 for device in devices: | 245 for device in devices: |
245 tombstones += _GetTombstonesForDevice(device, options) | 246 tombstones += _GetTombstonesForDevice(device, options) |
246 | 247 |
247 _ResolveTombstones(options.jobs, tombstones) | 248 _ResolveTombstones(options.jobs, tombstones) |
248 | 249 |
249 | 250 |
250 if __name__ == '__main__': | 251 if __name__ == '__main__': |
251 sys.exit(main()) | 252 sys.exit(main()) |
OLD | NEW |