def _event(self, event):
    """Converts a TraceEvent proto into a catapult trace event python value."""
    result = dict(
        pid=event.device_id,
        tid=event.resource_id,
        name=event.name,
        ts=event.timestamp_ps / 1000000.0)
    if event.duration_ps:
      result['ph'] = _TYPE_COMPLETE
      result['dur'] = event.duration_ps / 1000000.0
    else:
      result['ph'] = _TYPE_INSTANT
      result['s'] = _SCOPE_THREAD
    for key in dict(event.args):
      if 'args' not in result:
        result['args'] = {}
      result['args'][key] = event.args[key]
    return result
def _event ( self , event ) : result = dict ( pid = event . device_id , tid = event . resource_id , name = event . name , ts = event . timestamp_ps / 1000000.0 ) if event . duration_ps : result [ 'ph' ] = _TYPE_COMPLETE result [ 'dur' ] = event . duration_ps / 1000000.0 else : result [ 'ph' ] = _TYPE_INSTANT result [ 's' ] = _SCOPE_THREAD for key in dict ( event . args ) : if 'args' not in result : result [ 'args' ] = { } result [ 'args' ] [ key ] = event . args [ key ] return result
Converts a TraceEvent proto into a catapult trace event python value.