def GetNextMessageFromFile(file_to_parse): message_size = GetNextMessageSize(file_to_parse) if message_size == 0: return None try: event = debug_dump_pb2.Event() event.ParseFromString(file_to_parse.read(message_size)) except IOError: print 'Invalid message in file' return None return event
def InitDecisions(): decisions = {} event = debug_dump_pb2.Event() for decision in event.encoder_runtime_config.DESCRIPTOR.fields: decisions[decision.name] = {'time': [], 'value': []} return decisions
def InitMetrics(): metrics = {} event = debug_dump_pb2.Event() for metric in event.network_metrics.DESCRIPTOR.fields: metrics[metric.name] = {'time': [], 'value': []} return metrics