tools/android/appstats.py
def PrettyFile(self,
                 file_path,
                 snapshots,
                 diff_against_start,
                 show_mem=True,
                 show_net=True):
    """Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
    |diff_against_start| determines whether or not the snapshot deltas are
    between the first entry and all entries or each previous entry.  This output
    will not follow |self.can_color| or |self.overwrite|.  If |show_mem| is
    True, this will attempt to show memory statistics.  If |show_net| is True,
    this will attempt to show network statistics."""
    if not file_path or not snapshots:
      return

    # Output Format
    show_label = False
    show_timestamp = True
    show_trailer = False

    pids = self.__FindPidsForSnapshotList(snapshots)

    # Disable special output formatting for file writing.
    can_color = self.can_color
    self.can_color = False

    with open(file_path, 'w') as out:
      for (userid, pid, name) in pids:
        out.write(name + ' (' + str(pid) + '):\n')
        out.write(self.__PrintHeaderHelper(None,
                                           show_label,
                                           show_timestamp,
                                           show_mem,
                                           show_net,
                                           show_trailer))
        out.write('\n')

        prev_snapshot = None
        for snapshot in snapshots:
          has_mem = show_mem and snapshot.GetMemoryResults(pid) is not None
          has_net = show_net and snapshot.GetNetworkResults(userid) is not None
          if not has_mem and not has_net:
            continue
          out.write(self.__PrintStatsHelper(pid,
                                            snapshot,
                                            prev_snapshot,
                                            show_label,
                                            show_timestamp,
                                            show_mem,
                                            show_net))
          out.write('\n')
          if not prev_snapshot or not diff_against_start:
            prev_snapshot = snapshot
        out.write('\n\n')

    # Restore special output formatting.
    self.can_color = can_color
Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
    |diff_against_start| determines whether or not the snapshot deltas are
    between the first entry and all entries or each previous entry.  This output
    will not follow |self.can_color| or |self.overwrite|.  If |show_mem| is
    True, this will attempt to show memory statistics.  If |show_net| is True,
    this will attempt to show network statistics.
Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
|diff_against_start| determines whether or not the snapshot deltas are
between the first entry and all entries or each previous entry.
Writes |snapshots| ( a list of DeviceSnapshots ) to |file_path| . |diff_against_start| determines whether or not the snapshot deltas are between the first entry and all entries or each previous entry .
def PrettyFile(self,
                 file_path,
                 snapshots,
                 diff_against_start,
                 show_mem=True,
                 show_net=True):
    if not file_path or not snapshots:
      return
    show_label = False
    show_timestamp = True
    show_trailer = False
    pids = self.__FindPidsForSnapshotList(snapshots)
    can_color = self.can_color
    self.can_color = False
    with open(file_path, 'w') as out:
      for (userid, pid, name) in pids:
        out.write(name + ' (' + str(pid) + '):\n')
        out.write(self.__PrintHeaderHelper(None,
                                           show_label,
                                           show_timestamp,
                                           show_mem,
                                           show_net,
                                           show_trailer))
        out.write('\n')
        prev_snapshot = None
        for snapshot in snapshots:
          has_mem = show_mem and snapshot.GetMemoryResults(pid) is not None
          has_net = show_net and snapshot.GetNetworkResults(userid) is not None
          if not has_mem and not has_net:
            continue
          out.write(self.__PrintStatsHelper(pid,
                                            snapshot,
                                            prev_snapshot,
                                            show_label,
                                            show_timestamp,
                                            show_mem,
                                            show_net))
          out.write('\n')
          if not prev_snapshot or not diff_against_start:
            prev_snapshot = snapshot
        out.write('\n\n')
    self.can_color = can_color
def PrettyFile ( self , file_path , snapshots , diff_against_start , show_mem = True , show_net = True ) : if not file_path or not snapshots : return show_label = False show_timestamp = True show_trailer = False pids = self . __FindPidsForSnapshotList ( snapshots ) can_color = self . can_color self . can_color = False with open ( file_path , 'w' ) as out : for ( userid , pid , name ) in pids : out . write ( name + ' (' + str ( pid ) + '):\n' ) out . write ( self . __PrintHeaderHelper ( None , show_label , show_timestamp , show_mem , show_net , show_trailer ) ) out . write ( '\n' ) prev_snapshot = None for snapshot in snapshots : has_mem = show_mem and snapshot . GetMemoryResults ( pid ) is not None has_net = show_net and snapshot . GetNetworkResults ( userid ) is not None if not has_mem and not has_net : continue out . write ( self . __PrintStatsHelper ( pid , snapshot , prev_snapshot , show_label , show_timestamp , show_mem , show_net ) ) out . write ( '\n' ) if not prev_snapshot or not diff_against_start : prev_snapshot = snapshot out . write ( '\n\n' ) self . can_color = can_color
Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
Writes |snapshots| ( a list of DeviceSnapshots ) to |file_path| .
"""Writes |snapshots| (a list of DeviceSnapshots) to |file_path|.
    |diff_against_start| determines whether or not the snapshot deltas are
    between the first entry and all entries or each previous entry.  This output
    will not follow |self.can_color| or |self.overwrite|.  If |show_mem| is
    True, this will attempt to show memory statistics.  If |show_net| is True,
    this will attempt to show network statistics.""" # Output Format # Disable special output formatting for file writing. # Restore special output formatting.
self
file_path
snapshots
diff_against_start
show_mem
show_net