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 import datetime | 5 import datetime |
6 import json | 6 import json |
7 import math | 7 import math |
8 import random | 8 import random |
9 import uuid | 9 import uuid |
10 | 10 |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 unused_parent_hist, unused_other_parent_hist): | 609 unused_parent_hist, unused_other_parent_hist): |
610 for name, story_display_names in\ | 610 for name, story_display_names in\ |
611 other_diagnostic.tags_to_story_names.iteritems(): | 611 other_diagnostic.tags_to_story_names.iteritems(): |
612 if not name in self.tags_to_story_names: | 612 if not name in self.tags_to_story_names: |
613 self.tags_to_story_names[name] = set() | 613 self.tags_to_story_names[name] = set() |
614 | 614 |
615 for t in story_display_names: | 615 for t in story_display_names: |
616 self.tags_to_story_names[name].add(t) | 616 self.tags_to_story_names[name].add(t) |
617 | 617 |
618 | 618 |
619 # TODO(benjhayden): Unify this with telemetry's IterationInfo. | |
620 class TelemetryInfo(diagnostic.Diagnostic): | |
621 | |
622 def __init__(self): | |
623 super(TelemetryInfo, self).__init__() | |
624 self._benchmark_name = '' | |
625 self._benchmark_start = None | |
626 self._label = '' | |
627 self._legacy_tir_label = '' | |
628 self._story_display_name = '' | |
629 self._story_grouping_keys = {} | |
630 self._story_url = '' | |
631 self._storyset_repeat_counter = None | |
632 | |
633 def __eq__(self, other): | |
634 if self.benchmark_name != other.benchmark_name: | |
635 return False | |
636 if self.benchmark_start != other.benchmark_start: | |
637 return False | |
638 if self.label != other.label: | |
639 return False | |
640 if self.legacy_tir_label != other.legacy_tir_label: | |
641 return False | |
642 if self.story_display_name != other.story_display_name: | |
643 return False | |
644 if self.story_grouping_keys != other.story_grouping_keys: | |
645 return False | |
646 if self.story_url != other.story_url: | |
647 return False | |
648 if self.storyset_repeat_counter != other.storyset_repeat_counter: | |
649 return False | |
650 return True | |
651 | |
652 def __ne__(self, other): | |
653 return not self == other | |
654 | |
655 def AddInfo(self, info): | |
656 if 'benchmarkName' in info: | |
657 self._benchmark_name = info['benchmarkName'] | |
658 if 'benchmarkStartMs' in info: | |
659 self._benchmark_start = info['benchmarkStartMs'] | |
660 if 'label' in info: | |
661 self._label = info['label'] | |
662 if 'storyDisplayName' in info: | |
663 self._story_display_name = info['storyDisplayName'] | |
664 if 'storyGroupingKeys' in info: | |
665 self._story_grouping_keys = info['storyGroupingKeys'] | |
666 if 'storysetRepeatCounter' in info: | |
667 self._storyset_repeat_counter = info['storysetRepeatCounter'] | |
668 if 'legacyTIRLabel' in info: | |
669 self._legacy_tir_label = info['legacyTIRLabel'] | |
670 | |
671 def _AsDictInto(self, d): | |
672 d['benchmarkName'] = self.benchmark_name | |
673 d['benchmarkStartMs'] = self.benchmark_start | |
674 d['label'] = self.label | |
675 d['storyDisplayName'] = self.story_display_name | |
676 d['storyGroupingKeys'] = self.story_grouping_keys | |
677 d['storysetRepeatCounter'] = self.storyset_repeat_counter | |
678 d['legacyTIRLabel'] = self.legacy_tir_label | |
679 | |
680 @property | |
681 def benchmark_name(self): | |
682 return self._benchmark_name | |
683 | |
684 @property | |
685 def benchmark_start(self): | |
686 return self._benchmark_start | |
687 | |
688 @property | |
689 def label(self): | |
690 return self._label | |
691 | |
692 @property | |
693 def story_display_name(self): | |
694 return self._story_display_name | |
695 | |
696 @property | |
697 def story_grouping_keys(self): | |
698 return self._story_grouping_keys | |
699 | |
700 @property | |
701 def storyset_repeat_counter(self): | |
702 return self._storyset_repeat_counter | |
703 | |
704 @property | |
705 def story_url(self): | |
706 return self._story_url | |
707 | |
708 @property | |
709 def legacy_tir_label(self): | |
710 return self._legacy_tir_label | |
711 | |
712 @staticmethod | |
713 def FromDict(d): | |
714 info = TelemetryInfo() | |
715 info.AddInfo(d) | |
716 return info | |
717 | |
718 | |
719 class RelatedEventSet(diagnostic.Diagnostic): | 619 class RelatedEventSet(diagnostic.Diagnostic): |
720 | 620 |
721 def __init__(self): | 621 def __init__(self): |
722 super(RelatedEventSet, self).__init__() | 622 super(RelatedEventSet, self).__init__() |
723 self._events_by_stable_id = {} | 623 self._events_by_stable_id = {} |
724 | 624 |
725 def Add(self, event): | 625 def Add(self, event): |
726 self._events_by_stable_id[event['stableId']] = event | 626 self._events_by_stable_id[event['stableId']] = event |
727 | 627 |
728 def __len__(self): | 628 def __len__(self): |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 | 1372 |
1473 | 1373 |
1474 all_diagnostics.DIAGNOSTICS_BY_NAME.update({ | 1374 all_diagnostics.DIAGNOSTICS_BY_NAME.update({ |
1475 'Breakdown': Breakdown, | 1375 'Breakdown': Breakdown, |
1476 'GenericSet': GenericSet, | 1376 'GenericSet': GenericSet, |
1477 'UnmergeableDiagnosticSet': UnmergeableDiagnosticSet, | 1377 'UnmergeableDiagnosticSet': UnmergeableDiagnosticSet, |
1478 'RelatedEventSet': RelatedEventSet, | 1378 'RelatedEventSet': RelatedEventSet, |
1479 'DateRange': DateRange, | 1379 'DateRange': DateRange, |
1480 'TagMap': TagMap, | 1380 'TagMap': TagMap, |
1481 'RelatedHistogramBreakdown': RelatedHistogramBreakdown, | 1381 'RelatedHistogramBreakdown': RelatedHistogramBreakdown, |
1482 'TelemetryInfo': TelemetryInfo, | |
1483 'RelatedHistogramMap': RelatedHistogramMap, | 1382 'RelatedHistogramMap': RelatedHistogramMap, |
1484 }) | 1383 }) |
OLD | NEW |