OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 from tracing.value import histogram as histogram_module | 5 from tracing.value import histogram as histogram_module |
6 from tracing.value.diagnostics import all_diagnostics | 6 from tracing.value.diagnostics import all_diagnostics |
7 from tracing.value.diagnostics import diagnostic | 7 from tracing.value.diagnostics import diagnostic |
8 from tracing.value.diagnostics import diagnostic_ref | 8 from tracing.value.diagnostics import diagnostic_ref |
9 | 9 |
10 class HistogramSet(object): | 10 class HistogramSet(object): |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 def LookupHistogram(self, guid): | 47 def LookupHistogram(self, guid): |
48 return self._histograms_by_guid.get(guid) | 48 return self._histograms_by_guid.get(guid) |
49 | 49 |
50 def LookupDiagnostic(self, guid): | 50 def LookupDiagnostic(self, guid): |
51 return self._shared_diagnostics_by_guid.get(guid) | 51 return self._shared_diagnostics_by_guid.get(guid) |
52 | 52 |
53 def ResolveRelatedHistograms(self): | 53 def ResolveRelatedHistograms(self): |
54 histograms = self | 54 histograms = self |
55 def HandleDiagnosticMap(dm): | 55 def HandleDiagnosticMap(dm): |
56 for diag in dm.itervalues(): | 56 for diag in dm.itervalues(): |
57 if isinstance( | 57 if isinstance(diag, histogram_module.RelatedHistogramMap): |
58 diag, (histogram_module.RelatedHistogramSet, | |
59 histogram_module.RelatedHistogramMap)): | |
60 diag.Resolve(histograms) | 58 diag.Resolve(histograms) |
61 | 59 |
62 for hist in self: | 60 for hist in self: |
63 hist.diagnostics.ResolveSharedDiagnostics(self) | 61 hist.diagnostics.ResolveSharedDiagnostics(self) |
64 HandleDiagnosticMap(hist.diagnostics) | 62 HandleDiagnosticMap(hist.diagnostics) |
65 for dm in hist.nan_diagnostic_maps: | 63 for dm in hist.nan_diagnostic_maps: |
66 HandleDiagnosticMap(dm) | 64 HandleDiagnosticMap(dm) |
67 for hbin in hist.bins: | 65 for hbin in hist.bins: |
68 for dm in hbin.diagnostic_maps: | 66 for dm in hbin.diagnostic_maps: |
69 HandleDiagnosticMap(dm) | 67 HandleDiagnosticMap(dm) |
(...skipping 22 matching lines...) Expand all Loading... |
92 return dcts | 90 return dcts |
93 | 91 |
94 def ReplaceSharedDiagnostic(self, old_guid, new_diagnostic): | 92 def ReplaceSharedDiagnostic(self, old_guid, new_diagnostic): |
95 if not isinstance(new_diagnostic, diagnostic_ref.DiagnosticRef): | 93 if not isinstance(new_diagnostic, diagnostic_ref.DiagnosticRef): |
96 self._shared_diagnostics_by_guid[new_diagnostic.guid] = new_diagnostic | 94 self._shared_diagnostics_by_guid[new_diagnostic.guid] = new_diagnostic |
97 | 95 |
98 for hist in self: | 96 for hist in self: |
99 for name, diag in hist.diagnostics.iteritems(): | 97 for name, diag in hist.diagnostics.iteritems(): |
100 if diag.has_guid and diag.guid == old_guid: | 98 if diag.has_guid and diag.guid == old_guid: |
101 hist.diagnostics[name] = new_diagnostic | 99 hist.diagnostics[name] = new_diagnostic |
OLD | NEW |