tools/mac/power/collapse_profile.py
def remove_tokens(self, stack):
    """Removes some substrings from frames in the stack.

    Args:
      stack: An array of strings that represent each frame of a stack trace.

    Returns: The input array with zero or more frames modified.
    """

    # Drop parts of the function names that just add noise.
    tokens_to_remove = [
        "Chromium Framework`", "libsystem_kernel.dylib`", "Security`"
    ]

    for i, frame in enumerate(stack):
      for token in tokens_to_remove:
        # If removing the token would result in an empty string don't
        # remove it.
        if stack[i] != token:
          stack[i] = stack[i].replace(token, "")

    return stack
Removes some substrings from frames in the stack.

    Args:
      stack: An array of strings that represent each frame of a stack trace.

    Returns: The input array with zero or more frames modified.
    
Removes some substrings from frames in the stack.
Removes some substrings from frames in the stack .
def remove_tokens(self, stack):
    tokens_to_remove = [
        "Chromium Framework`", "libsystem_kernel.dylib`", "Security`"
    ]
    for i, frame in enumerate(stack):
      for token in tokens_to_remove:
        if stack[i] != token:
          stack[i] = stack[i].replace(token, "")
    return stack
def remove_tokens ( self , stack ) : tokens_to_remove = [ "Chromium Framework`" , "libsystem_kernel.dylib`" , "Security`" ] for i , frame in enumerate ( stack ) : for token in tokens_to_remove : if stack [ i ] != token : stack [ i ] = stack [ i ] . replace ( token , "" ) return stack
Removes some substrings from frames in the stack.
Removes some substrings from frames in the stack .
"""Removes some substrings from frames in the stack.

    Args:
      stack: An array of strings that represent each frame of a stack trace.

    Returns: The input array with zero or more frames modified.
    """ # Drop parts of the function names that just add noise. # If removing the token would result in an empty string don't # remove it.
self
stack
An array of strings that represent each frame of a stack trace.
An array of strings that represent each frame of a stack trace .