Exemplo n.º 1
0
def _DiffSymbolGroups(before, after):
    # For changed symbols, padding is zeroed out. In order to not lose the
    # information entirely, store it in aggregate.
    padding_by_section_name = collections.defaultdict(int)

    # Usually >90% of symbols are exact matches, so all of the time is spent in
    # this first pass.
    all_deltas, before, after = _MatchSymbols(before, after, _ExactMatchKey,
                                              padding_by_section_name)
    for key_func in (_GoodMatchKey, _PoorMatchKey):
        delta_syms, before, after = _MatchSymbols(before, after, key_func,
                                                  padding_by_section_name)
        all_deltas.extend(delta_syms)

    logging.debug('Creating %d unmatched symbols', len(after) + len(before))
    for after_sym in after:
        all_deltas.append(models.DeltaSymbol(None, after_sym))
    for before_sym in before:
        all_deltas.append(models.DeltaSymbol(before_sym, None))

    # Create a DeltaSymbol to represent the zero'd out padding of matched symbols.
    for section_name, padding in padding_by_section_name.iteritems():
        if padding != 0:
            after_sym = models.Symbol(
                section_name,
                padding,
                name="** aggregate padding of diff'ed symbols")
            after_sym.padding = padding
            all_deltas.append(models.DeltaSymbol(None, after_sym))

    return models.DeltaSymbolGroup(all_deltas)
Exemplo n.º 2
0
def _DiffSymbolGroups(before, after):
    # For changed symbols, padding is zeroed out. In order to not lose the
    # information entirely, store it in aggregate.
    padding_by_section_name = collections.defaultdict(int)

    # Usually >90% of symbols are exact matches, so all of the time is spent in
    # this first pass.
    all_deltas, before, after = _MatchSymbols(before, after, _Key1,
                                              padding_by_section_name)
    for key_func in (_Key2, _Key3, _Key4):
        delta_syms, before, after = _MatchSymbols(before, after, key_func,
                                                  padding_by_section_name)
        all_deltas.extend(delta_syms)

    logging.debug('Creating %d unmatched symbols', len(after) + len(before))
    for after_sym in after:
        all_deltas.append(models.DeltaSymbol(None, after_sym))
    for before_sym in before:
        all_deltas.append(models.DeltaSymbol(before_sym, None))

    # Create a DeltaSymbol to represent the zero'd out padding of matched symbols.
    for section_name, padding in padding_by_section_name.items():
        if padding != 0:
            after_sym = models.Symbol(section_name, padding)
            # This is after _NormalizeNames() is called, so set |full_name|,
            # |template_name|, and |name|.
            after_sym.SetName("Overhead: aggregate padding of diff'ed symbols")
            after_sym.padding = padding
            all_deltas.append(models.DeltaSymbol(None, after_sym))

    return models.DeltaSymbolGroup(all_deltas)
Exemplo n.º 3
0
def _DiffSymbolGroups(containers, before, after):
    # For changed symbols, padding is zeroed out. In order to not lose the
    # information entirely, store it in aggregate. These aggregations are grouped
    # by "segment names", which are (container name, section name) tuples.
    padding_by_segment = collections.defaultdict(float)

    # Usually >90% of symbols are exact matches, so all of the time is spent in
    # this first pass.
    all_deltas, before, after = _MatchSymbols(before, after, _Key1,
                                              padding_by_segment)
    for key_func in (_Key2, _Key3, _Key4):
        delta_syms, before, after = _MatchSymbols(before, after, key_func,
                                                  padding_by_segment)
        all_deltas.extend(delta_syms)

    logging.debug('Creating %d unmatched symbols', len(after) + len(before))
    for after_sym in after:
        all_deltas.append(models.DeltaSymbol(None, after_sym))
    for before_sym in before:
        all_deltas.append(models.DeltaSymbol(before_sym, None))

    container_from_name = {c.name: c for c in containers}

    # Create a DeltaSymbol to represent the zero'd out padding of matched symbols.
    for (container_name, section_name), padding in padding_by_segment.items():
        # Values need to be integer (crbug.com/1132394).
        padding = round(padding)
        if padding != 0:
            after_sym = models.Symbol(section_name, padding)
            after_sym.container = container_from_name[container_name]
            # This is after _NormalizeNames() is called, so set |full_name|,
            # |template_name|, and |name|.
            after_sym.SetName("Overhead: aggregate padding of diff'ed symbols")
            after_sym.padding = padding
            all_deltas.append(models.DeltaSymbol(None, after_sym))

    return models.DeltaSymbolGroup(all_deltas)