code: def _events(self):
      
      for did, device in sorted(six.iteritems(self._proto.devices)):
        if device.name:
          yield dict(
              ph=_TYPE_METADATA,
              pid=did,
              name='process_name',
              args=dict(name=device.name))
        yield dict(
            ph=_TYPE_METADATA,
            pid=did,
            name='process_sort_index',
            args=dict(sort_index=did))
        for rid, resource in sorted(six.iteritems(device.resources)):
          if resource.name:
            yield dict(
                ph=_TYPE_METADATA,
                pid=did,
                tid=rid,
                name='thread_name',
                args=dict(name=resource.name))
          yield dict(
              ph=_TYPE_METADATA,
              pid=did,
              tid=rid,
              name='thread_sort_index',
              args=dict(sort_index=rid))
      # TODO(sammccall): filtering and downsampling?
      for event in self._proto.trace_events:
        yield self._event(event)
docs: Iterator over all catapult trace events, as python values.