tools/memory/partition_allocator/trace_utils.py
def _ProcessNamesAndLabels(trace: dict) -> (dict, dict):
  """Get mappings of pid to name and pid to label.

  Args:
    trace: Trace content as returned by LoadTrace.

  Returns:
    A tuple containing two dicts. The first maps pids to names, the second maps
    pids to labels.
  """
  # Process names and labels.
  pid_to_name = {}
  pid_to_labels = {}

  metadata_events = [
      e for e in trace['traceEvents'] if e['cat'] == '__metadata'
  ]

  process_name_events = [
      e for e in metadata_events if e['name'] == 'process_name'
  ]
  for e in process_name_events:
    pid_to_name[e['pid']] = e['args']['name']

  process_labels_events = [
      e for e in metadata_events if e['name'] == 'process_labels'
  ]
  for e in process_labels_events:
    pid_to_labels[e['pid']] = e['args']['labels']

  return pid_to_name, pid_to_labels
Get mappings of pid to name and pid to label.

  Args:
    trace: Trace content as returned by LoadTrace.

  Returns:
    A tuple containing two dicts. The first maps pids to names, the second maps
    pids to labels.
  
Get mappings of pid to name and pid to label.
Get mappings of pid to name and pid to label .
def _ProcessNamesAndLabels(trace: dict) -> (dict, dict):
  pid_to_name = {}
  pid_to_labels = {}
  metadata_events = [
      e for e in trace['traceEvents'] if e['cat'] == '__metadata'
  ]
  process_name_events = [
      e for e in metadata_events if e['name'] == 'process_name'
  ]
  for e in process_name_events:
    pid_to_name[e['pid']] = e['args']['name']
  process_labels_events = [
      e for e in metadata_events if e['name'] == 'process_labels'
  ]
  for e in process_labels_events:
    pid_to_labels[e['pid']] = e['args']['labels']
  return pid_to_name, pid_to_labels
def _ProcessNamesAndLabels ( trace : dict ) -> ( dict , dict ) : pid_to_name = { } pid_to_labels = { } metadata_events = [ e for e in trace [ 'traceEvents' ] if e [ 'cat' ] == '__metadata' ] process_name_events = [ e for e in metadata_events if e [ 'name' ] == 'process_name' ] for e in process_name_events : pid_to_name [ e [ 'pid' ] ] = e [ 'args' ] [ 'name' ] process_labels_events = [ e for e in metadata_events if e [ 'name' ] == 'process_labels' ] for e in process_labels_events : pid_to_labels [ e [ 'pid' ] ] = e [ 'args' ] [ 'labels' ] return pid_to_name , pid_to_labels
Get mappings of pid to name and pid to label.
Get mappings of pid to name and pid to label .
"""Get mappings of pid to name and pid to label.

  Args:
    trace: Trace content as returned by LoadTrace.

  Returns:
    A tuple containing two dicts. The first maps pids to names, the second maps
    pids to labels.
  """ # Process names and labels.
A tuple containing two dicts. The first maps pids to names, the second maps
pids to labels.
A tuple containing two dicts . The first maps pids to names the second maps pids to labels .
trace
dict
Trace content as returned by LoadTrace.
Trace content as returned by LoadTrace .