tools/metrics/histograms/print_expanded_histograms.py
def ConstructHistogram(doc, name, histogram_dict):
  """Constructs a histogram node based on the |histogram_dict|."""
  histogram = doc.createElement('histogram')
  # Set histogram node attributes.
  histogram.setAttribute('name', name)
  if 'enum' in histogram_dict:
    histogram.setAttribute('enum', histogram_dict['enum']['name'])
  else:
    histogram.setAttribute('units', histogram_dict['units'])
  if 'expires_after' in histogram_dict:
    histogram.setAttribute('expires_after', histogram_dict['expires_after'])
  if histogram_dict.get('base', False):
    histogram.setAttribute('base', 'True')
  # Populate the obsolete node.
  if 'obsolete' in histogram_dict:
    obsolete_node = doc.createElement('obsolete')
    obsolete_node.appendChild(doc.createTextNode(histogram_dict['obsolete']))
    histogram.appendChild(obsolete_node)
  # Populate owner nodes.
  for owner in histogram_dict['owners']:
    owner_node = doc.createElement('owner')
    owner_node.appendChild(doc.createTextNode(owner))
    histogram.appendChild(owner_node)
  # Populate the summary nodes.
  if 'summary' in histogram_dict:
    summary_node = doc.createElement('summary')
    summary_node.appendChild(doc.createTextNode(histogram_dict['summary']))
    histogram.appendChild(summary_node)
  return histogram
Constructs a histogram node based on the |histogram_dict|.
Constructs a histogram node based on the |histogram_dict|.
Constructs a histogram node based on the |histogram_dict| .
def ConstructHistogram(doc, name, histogram_dict):
  histogram = doc.createElement('histogram')
  histogram.setAttribute('name', name)
  if 'enum' in histogram_dict:
    histogram.setAttribute('enum', histogram_dict['enum']['name'])
  else:
    histogram.setAttribute('units', histogram_dict['units'])
  if 'expires_after' in histogram_dict:
    histogram.setAttribute('expires_after', histogram_dict['expires_after'])
  if histogram_dict.get('base', False):
    histogram.setAttribute('base', 'True')
  if 'obsolete' in histogram_dict:
    obsolete_node = doc.createElement('obsolete')
    obsolete_node.appendChild(doc.createTextNode(histogram_dict['obsolete']))
    histogram.appendChild(obsolete_node)
  for owner in histogram_dict['owners']:
    owner_node = doc.createElement('owner')
    owner_node.appendChild(doc.createTextNode(owner))
    histogram.appendChild(owner_node)
  if 'summary' in histogram_dict:
    summary_node = doc.createElement('summary')
    summary_node.appendChild(doc.createTextNode(histogram_dict['summary']))
    histogram.appendChild(summary_node)
  return histogram
def ConstructHistogram ( doc , name , histogram_dict ) : histogram = doc . createElement ( 'histogram' ) histogram . setAttribute ( 'name' , name ) if 'enum' in histogram_dict : histogram . setAttribute ( 'enum' , histogram_dict [ 'enum' ] [ 'name' ] ) else : histogram . setAttribute ( 'units' , histogram_dict [ 'units' ] ) if 'expires_after' in histogram_dict : histogram . setAttribute ( 'expires_after' , histogram_dict [ 'expires_after' ] ) if histogram_dict . get ( 'base' , False ) : histogram . setAttribute ( 'base' , 'True' ) if 'obsolete' in histogram_dict : obsolete_node = doc . createElement ( 'obsolete' ) obsolete_node . appendChild ( doc . createTextNode ( histogram_dict [ 'obsolete' ] ) ) histogram . appendChild ( obsolete_node ) for owner in histogram_dict [ 'owners' ] : owner_node = doc . createElement ( 'owner' ) owner_node . appendChild ( doc . createTextNode ( owner ) ) histogram . appendChild ( owner_node ) if 'summary' in histogram_dict : summary_node = doc . createElement ( 'summary' ) summary_node . appendChild ( doc . createTextNode ( histogram_dict [ 'summary' ] ) ) histogram . appendChild ( summary_node ) return histogram
Constructs a histogram node based on the |histogram_dict|.
Constructs a histogram node based on the |histogram_dict| .
"""Constructs a histogram node based on the |histogram_dict|.""" # Set histogram node attributes. # Populate the obsolete node. # Populate owner nodes. # Populate the summary nodes.
doc
name
histogram_dict