def _IncludeFrameAboveRoot(stacks, subtree_root_depth):
  """Should the frame above the root of the subtree be included?

  Include the frame if the performance change is a total shift of execution
  at the root (due for example to the root function being added, deleted, or
  renamed). Uses a simple heuristic rule to determine if this is the case.
  """
  if subtree_root_depth == 0:
    return False

  root = stacks[0]['frames'][subtree_root_depth]
  log_change_factor = root['log_change_factor']
  return log_change_factor in (float('inf'), float('-inf'))