tools/cygprofile/compare_orderfiles.py
def Compare(first_filename, second_filename):
  """Outputs a comparison of two orderfiles to stdout.

  Args:
    first_filename: (str) First orderfile.
    second_filename: (str) Second orderfile.

  Returns:
    An instance of CompareResult.
  """
  first_symbols = ParseOrderfile(first_filename)
  second_symbols = ParseOrderfile(second_filename)
  print('Symbols count:\n\tfirst:\t%d\n\tsecond:\t%d' % (len(first_symbols),
                                                         len(second_symbols)))
  first_symbols = set(first_symbols)
  second_symbols = set(second_symbols)
  new_symbols = second_symbols - first_symbols
  removed_symbols = first_symbols - second_symbols
  common_symbols = first_symbols & second_symbols
  # Distance between orderfiles.
  first_to_ordering = CommonSymbolsToOrder(first_symbols, common_symbols)
  second_to_ordering = CommonSymbolsToOrder(second_symbols, common_symbols)
  total_distance = sum(abs(first_to_ordering[s] - second_to_ordering[s])\
                       for s in first_to_ordering)
  # Each distance is in [0, len(common_symbols)] and there are
  # len(common_symbols) entries, hence the normalization.
  average_fractional_distance = float(total_distance) / (len(common_symbols)**2)
  print('New symbols = %d' % len(new_symbols))
  print('Removed symbols = %d' % len(removed_symbols))
  print('Average fractional distance = %.2f%%' %
        (100. * average_fractional_distance))
  return CompareResult(len(first_symbols), len(second_symbols),
                       len(new_symbols), len(removed_symbols),
                       average_fractional_distance)
Outputs a comparison of two orderfiles to stdout.

  Args:
    first_filename: (str) First orderfile.
    second_filename: (str) Second orderfile.

  Returns:
    An instance of CompareResult.
  
Outputs a comparison of two orderfiles to stdout.
Outputs a comparison of two orderfiles to stdout .
def Compare(first_filename, second_filename):
  first_symbols = ParseOrderfile(first_filename)
  second_symbols = ParseOrderfile(second_filename)
  print('Symbols count:\n\tfirst:\t%d\n\tsecond:\t%d' % (len(first_symbols),
                                                         len(second_symbols)))
  first_symbols = set(first_symbols)
  second_symbols = set(second_symbols)
  new_symbols = second_symbols - first_symbols
  removed_symbols = first_symbols - second_symbols
  common_symbols = first_symbols & second_symbols
  first_to_ordering = CommonSymbolsToOrder(first_symbols, common_symbols)
  second_to_ordering = CommonSymbolsToOrder(second_symbols, common_symbols)
  total_distance = sum(abs(first_to_ordering[s] - second_to_ordering[s])\
                       for s in first_to_ordering)
  average_fractional_distance = float(total_distance) / (len(common_symbols)**2)
  print('New symbols = %d' % len(new_symbols))
  print('Removed symbols = %d' % len(removed_symbols))
  print('Average fractional distance = %.2f%%' %
        (100. * average_fractional_distance))
  return CompareResult(len(first_symbols), len(second_symbols),
                       len(new_symbols), len(removed_symbols),
                       average_fractional_distance)
def Compare ( first_filename , second_filename ) : first_symbols = ParseOrderfile ( first_filename ) second_symbols = ParseOrderfile ( second_filename ) print ( 'Symbols count:\n\tfirst:\t%d\n\tsecond:\t%d' % ( len ( first_symbols ) , len ( second_symbols ) ) ) first_symbols = set ( first_symbols ) second_symbols = set ( second_symbols ) new_symbols = second_symbols - first_symbols removed_symbols = first_symbols - second_symbols common_symbols = first_symbols & second_symbols first_to_ordering = CommonSymbolsToOrder ( first_symbols , common_symbols ) second_to_ordering = CommonSymbolsToOrder ( second_symbols , common_symbols ) total_distance = sum ( abs ( first_to_ordering [ s ] - second_to_ordering [ s ] ) for s in first_to_ordering ) average_fractional_distance = float ( total_distance ) / ( len ( common_symbols ) ** 2 ) print ( 'New symbols = %d' % len ( new_symbols ) ) print ( 'Removed symbols = %d' % len ( removed_symbols ) ) print ( 'Average fractional distance = %.2f%%' % ( 100. * average_fractional_distance ) ) return CompareResult ( len ( first_symbols ) , len ( second_symbols ) , len ( new_symbols ) , len ( removed_symbols ) , average_fractional_distance )
Outputs a comparison of two orderfiles to stdout.
Outputs a comparison of two orderfiles to stdout .
"""Outputs a comparison of two orderfiles to stdout.

  Args:
    first_filename: (str) First orderfile.
    second_filename: (str) Second orderfile.

  Returns:
    An instance of CompareResult.
  """ # Distance between orderfiles. # Each distance is in [0, len(common_symbols)] and there are # len(common_symbols) entries, hence the normalization.
An instance of CompareResult.
An instance of CompareResult .
first_filename
(str) First orderfile.
( str ) First orderfile .
second_filename
(str) Second orderfile.
( str ) Second orderfile .