tools/cygprofile/cluster.py
def _GetSymbolsCallGraph(profiles, processor):
  """Maps each offset in the call graph to the corresponding symbol name.

  Args:
    profiles (ProfileManager) Manager of the profile dump files.
    processor (SymbolOffsetProcessor) Symbol table processor for the dumps.

  Returns:
    A dict that maps each process type (ex: browser, renderer, etc.) to a list
    of processes of that type. Each process is a list that contains the
    call graph information. The call graph is represented by a list where each
    item is a dict that contains: callee, 3 caller-count pairs, misses.
  """
  offsets_graph = profiles.GetProcessOffsetGraph();
  process_symbols_graph = collections.defaultdict(list)

  # |process_type| can be : browser, renderer, gpu-process, etc.
  for process_type in offsets_graph:
    for process in offsets_graph[process_type]:
      process = sorted(process, key=lambda k: int(k['index']))
      graph_list = []
      for el in process:
        index = int(el['index'])
        callee_symbol = _GetOffsetSymbolName(processor,
                                             int(el['callee_offset']))
        misses = 0
        caller_and_count = []
        for bucket in el['caller_and_count']:
          caller_offset = int(bucket['caller_offset'])
          count = int(bucket['count'])
          if caller_offset == 0:
            misses += count
            continue

          caller_symbol_name = _GetOffsetSymbolName(processor, caller_offset)
          caller_info = CallerInfo(caller_symbol=caller_symbol_name,
                                   count=count)
          caller_and_count.append(caller_info)

        callee_info = CalleeInfo(index=index,
                                 callee_symbol=callee_symbol,
                                 misses=misses,
                                 caller_and_count=caller_and_count)
        graph_list.append(callee_info)
      process_symbols_graph[process_type].append(graph_list)
  return process_symbols_graph
Maps each offset in the call graph to the corresponding symbol name.

  Args:
    profiles (ProfileManager) Manager of the profile dump files.
    processor (SymbolOffsetProcessor) Symbol table processor for the dumps.

  Returns:
    A dict that maps each process type (ex: browser, renderer, etc.) to a list
    of processes of that type. Each process is a list that contains the
    call graph information. The call graph is represented by a list where each
    item is a dict that contains: callee, 3 caller-count pairs, misses.
  
Maps each offset in the call graph to the corresponding symbol name.
Args:
profiles (ProfileManager) Manager of the profile dump files.
processor (SymbolOffsetProcessor) Symbol table processor for the dumps.

A dict that maps each process type (ex: browser, renderer, etc.) to a list
of processes of that type. Each process is a list that contains the
call graph information. The call graph is represented by a list where each
item is a dict that contains: callee, 3 caller-count pairs, misses.
Maps each offset in the call graph to the corresponding symbol name . Args : profiles ( ProfileManager ) Manager of the profile dump files . processor ( SymbolOffsetProcessor ) Symbol table processor for the dumps . A dict that maps each process type ( ex : browser renderer etc . ) to a list of processes of that type . Each process is a list that contains the call graph information . The call graph is represented by a list where each item is a dict that contains : callee 3 caller - count pairs misses .
def _GetSymbolsCallGraph(profiles, processor):
  offsets_graph = profiles.GetProcessOffsetGraph();
  process_symbols_graph = collections.defaultdict(list)
  for process_type in offsets_graph:
    for process in offsets_graph[process_type]:
      process = sorted(process, key=lambda k: int(k['index']))
      graph_list = []
      for el in process:
        index = int(el['index'])
        callee_symbol = _GetOffsetSymbolName(processor,
                                             int(el['callee_offset']))
        misses = 0
        caller_and_count = []
        for bucket in el['caller_and_count']:
          caller_offset = int(bucket['caller_offset'])
          count = int(bucket['count'])
          if caller_offset == 0:
            misses += count
            continue
          caller_symbol_name = _GetOffsetSymbolName(processor, caller_offset)
          caller_info = CallerInfo(caller_symbol=caller_symbol_name,
                                   count=count)
          caller_and_count.append(caller_info)
        callee_info = CalleeInfo(index=index,
                                 callee_symbol=callee_symbol,
                                 misses=misses,
                                 caller_and_count=caller_and_count)
        graph_list.append(callee_info)
      process_symbols_graph[process_type].append(graph_list)
  return process_symbols_graph
def _GetSymbolsCallGraph ( profiles , processor ) : offsets_graph = profiles . GetProcessOffsetGraph ( ) ; process_symbols_graph = collections . defaultdict ( list ) for process_type in offsets_graph : for process in offsets_graph [ process_type ] : process = sorted ( process , key = lambda k : int ( k [ 'index' ] ) ) graph_list = [ ] for el in process : index = int ( el [ 'index' ] ) callee_symbol = _GetOffsetSymbolName ( processor , int ( el [ 'callee_offset' ] ) ) misses = 0 caller_and_count = [ ] for bucket in el [ 'caller_and_count' ] : caller_offset = int ( bucket [ 'caller_offset' ] ) count = int ( bucket [ 'count' ] ) if caller_offset == 0 : misses += count continue caller_symbol_name = _GetOffsetSymbolName ( processor , caller_offset ) caller_info = CallerInfo ( caller_symbol = caller_symbol_name , count = count ) caller_and_count . append ( caller_info ) callee_info = CalleeInfo ( index = index , callee_symbol = callee_symbol , misses = misses , caller_and_count = caller_and_count ) graph_list . append ( callee_info ) process_symbols_graph [ process_type ] . append ( graph_list ) return process_symbols_graph
Maps each offset in the call graph to the corresponding symbol name.
Maps each offset in the call graph to the corresponding symbol name .
"""Maps each offset in the call graph to the corresponding symbol name.

  Args:
    profiles (ProfileManager) Manager of the profile dump files.
    processor (SymbolOffsetProcessor) Symbol table processor for the dumps.

  Returns:
    A dict that maps each process type (ex: browser, renderer, etc.) to a list
    of processes of that type. Each process is a list that contains the
    call graph information. The call graph is represented by a list where each
    item is a dict that contains: callee, 3 caller-count pairs, misses.
  """ # |process_type| can be : browser, renderer, gpu-process, etc.
profiles
processor