| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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 | 7 |
| 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
| 9 <link rel="import" href="/tracing/model/event_set.html"> | 9 <link rel="import" href="/tracing/model/event_set.html"> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 if (event instanceof tr.model.FlowEvent) | 21 if (event instanceof tr.model.FlowEvent) |
| 22 return; | 22 return; |
| 23 allAssociatedEvents.push(event); | 23 allAssociatedEvents.push(event); |
| 24 }); | 24 }); |
| 25 }); | 25 }); |
| 26 return allAssociatedEvents; | 26 return allAssociatedEvents; |
| 27 } | 27 } |
| 28 | 28 |
| 29 function getUnassociatedEvents(model, associatedEvents) { | 29 function getUnassociatedEvents(model, associatedEvents) { |
| 30 var unassociatedEvents = new tr.model.EventSet(); | 30 var unassociatedEvents = new tr.model.EventSet(); |
| 31 model.getAllProcesses().forEach(function(process) { | 31 // The set of unassociated events contains only events that are not in |
| 32 for (var tid in process.threads) { | 32 // the set of associated events. |
| 33 var thread = process.threads[tid]; | 33 // Only add event to the set of unassociated events if it is not in |
| 34 thread.sliceGroup.iterateAllEvents(function(event) { | 34 // the set of associated events. |
| 35 // The set of unassociated events contains only events that are not in | 35 for (var proc of model.getAllProcesses()) |
| 36 // the set of associated events. | 36 for (var thread of tr.b.dictionaryValues(proc.threads)) |
| 37 // Only add event to the set of unassociated events if it is not in | 37 for (var event of thread.sliceGroup.getDescendantEvents()) |
| 38 // the set of associated events. | |
| 39 if (!associatedEvents.contains(event)) | 38 if (!associatedEvents.contains(event)) |
| 40 unassociatedEvents.push(event); | 39 unassociatedEvents.push(event); |
| 41 }); | |
| 42 } | |
| 43 }); | |
| 44 return unassociatedEvents; | 40 return unassociatedEvents; |
| 45 } | 41 } |
| 46 | 42 |
| 47 function getTotalCpuDuration(events) { | 43 function getTotalCpuDuration(events) { |
| 48 var cpuMs = 0; | 44 var cpuMs = 0; |
| 49 events.forEach(function(event) { | 45 events.forEach(function(event) { |
| 50 // Add up events' cpu self time if they have any. | 46 // Add up events' cpu self time if they have any. |
| 51 if (event.cpuSelfTime) | 47 if (event.cpuSelfTime) |
| 52 cpuMs += event.cpuSelfTime; | 48 cpuMs += event.cpuSelfTime; |
| 53 }); | 49 }); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 }; | 78 }; |
| 83 } | 79 } |
| 84 | 80 |
| 85 return { | 81 return { |
| 86 getIRCoverageFromModel: getIRCoverageFromModel, | 82 getIRCoverageFromModel: getIRCoverageFromModel, |
| 87 getAssociatedEvents: getAssociatedEvents, | 83 getAssociatedEvents: getAssociatedEvents, |
| 88 getUnassociatedEvents: getUnassociatedEvents | 84 getUnassociatedEvents: getUnassociatedEvents |
| 89 }; | 85 }; |
| 90 }); | 86 }); |
| 91 </script> | 87 </script> |
| OLD | NEW |