tools/android/native_lib_memory/process_residency.py
def WriteJsonOutput(data, filename):
  """Serializes the parsed data to JSON.

  Args:
    data: (dict) As returned by ParseDump()
    filename: (str) output filename.

  JSON format:
  {'offset': int, 'data': {
    relative_timestamp: [{'page_offset': int, 'resident': bool}]}}

  Where:
    - offset is the code start offset into its page
    - relative_timestamp is the offset in ns since the first measurement
    - page_offset is the page offset in bytes
  """
  result = {'offset': data['start'], 'data': {}}
  start_timestamp = min(data['residency'].keys())
  for timestamp in data['residency']:
    adjusted_timestamp = timestamp - start_timestamp
    result[adjusted_timestamp] = []
    residency = data['residency'][timestamp]
    for (index, resident) in enumerate(residency):
      result[adjusted_timestamp].append(
          {'offset': index * (1 << 12), 'resident': resident})
  with open(filename, 'w') as f:
    json.dump(result, f)
Serializes the parsed data to JSON.

  Args:
    data: (dict) As returned by ParseDump()
    filename: (str) output filename.

  JSON format:
  {'offset': int, 'data': {
    relative_timestamp: [{'page_offset': int, 'resident': bool}]}}

  Where:
    - offset is the code start offset into its page
    - relative_timestamp is the offset in ns since the first measurement
    - page_offset is the page offset in bytes
  
Serializes the parsed data to JSON.
Serializes the parsed data to JSON .
def WriteJsonOutput(data, filename):
  result = {'offset': data['start'], 'data': {}}
  start_timestamp = min(data['residency'].keys())
  for timestamp in data['residency']:
    adjusted_timestamp = timestamp - start_timestamp
    result[adjusted_timestamp] = []
    residency = data['residency'][timestamp]
    for (index, resident) in enumerate(residency):
      result[adjusted_timestamp].append(
          {'offset': index * (1 << 12), 'resident': resident})
  with open(filename, 'w') as f:
    json.dump(result, f)
def WriteJsonOutput ( data , filename ) : result = { 'offset' : data [ 'start' ] , 'data' : { } } start_timestamp = min ( data [ 'residency' ] . keys ( ) ) for timestamp in data [ 'residency' ] : adjusted_timestamp = timestamp - start_timestamp result [ adjusted_timestamp ] = [ ] residency = data [ 'residency' ] [ timestamp ] for ( index , resident ) in enumerate ( residency ) : result [ adjusted_timestamp ] . append ( { 'offset' : index * ( 1 << 12 ) , 'resident' : resident } ) with open ( filename , 'w' ) as f : json . dump ( result , f )
Serializes the parsed data to JSON.
Serializes the parsed data to JSON .
"""Serializes the parsed data to JSON.

  Args:
    data: (dict) As returned by ParseDump()
    filename: (str) output filename.

  JSON format:
  {'offset': int, 'data': {
    relative_timestamp: [{'page_offset': int, 'resident': bool}]}}

  Where:
    - offset is the code start offset into its page
    - relative_timestamp is the offset in ns since the first measurement
    - page_offset is the page offset in bytes
  """
data
(dict) As returned by ParseDump()
( dict ) As returned by ParseDump ()
filename
(str) output filename.
( str ) output filename .