OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 ''' TraceEventImporter imports TraceEvent-formatted data | 4 ''' TraceEventImporter imports TraceEvent-formatted data |
5 into the provided model. | 5 into the provided model. |
6 This is a port of the trace event importer from | 6 This is a port of the trace event importer from |
7 https://code.google.com/p/trace-viewer/ | 7 https://code.google.com/p/trace-viewer/ |
8 ''' | 8 ''' |
9 | 9 |
10 import copy | 10 import copy |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 def FinalizeImport(self): | 215 def FinalizeImport(self): |
216 '''Called by the Model after all other importers have imported their | 216 '''Called by the Model after all other importers have imported their |
217 events.''' | 217 events.''' |
218 self._model.UpdateBounds() | 218 self._model.UpdateBounds() |
219 | 219 |
220 # We need to reupdate the bounds in case the minimum start time changes | 220 # We need to reupdate the bounds in case the minimum start time changes |
221 self._model.UpdateBounds() | 221 self._model.UpdateBounds() |
222 self._CreateAsyncSlices() | 222 self._CreateAsyncSlices() |
223 self._CreateFlowSlices() | 223 self._CreateFlowSlices() |
224 self._SetBrowserProcess() | 224 self._SetBrowserProcess() |
| 225 self._SetGpuProcess() |
225 self._CreateExplicitObjects() | 226 self._CreateExplicitObjects() |
226 self._CreateImplicitObjects() | 227 self._CreateImplicitObjects() |
227 | 228 |
228 def _CreateAsyncSlices(self): | 229 def _CreateAsyncSlices(self): |
229 if len(self._all_async_events) == 0: | 230 if len(self._all_async_events) == 0: |
230 return | 231 return |
231 | 232 |
232 self._all_async_events.sort( | 233 self._all_async_events.sort( |
233 cmp=lambda x, y: int(x['event']['ts'] - y['event']['ts'])) | 234 cmp=lambda x, y: int(x['event']['ts'] - y['event']['ts'])) |
234 | 235 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if event['ph'] == 'f': | 389 if event['ph'] == 'f': |
389 del flow_id_to_event[event['id']] | 390 del flow_id_to_event[event['id']] |
390 else: | 391 else: |
391 # Make this event the next start event in this flow. | 392 # Make this event the next start event in this flow. |
392 flow_id_to_event[event['id']] = flow_event | 393 flow_id_to_event[event['id']] = flow_event |
393 | 394 |
394 def _SetBrowserProcess(self): | 395 def _SetBrowserProcess(self): |
395 for thread in self._model.GetAllThreads(): | 396 for thread in self._model.GetAllThreads(): |
396 if thread.name == 'CrBrowserMain': | 397 if thread.name == 'CrBrowserMain': |
397 self._model.browser_process = thread.parent | 398 self._model.browser_process = thread.parent |
| 399 |
| 400 def _SetGpuProcess(self): |
| 401 for thread in self._model.GetAllThreads(): |
| 402 if thread.name == 'CrGpuMain': |
| 403 self._model.gpu_process = thread.parent |
OLD | NEW |