Beispiel #1
0
    def encode(self):
        parts = []
        if self.benchmark_start_time_us is not None:
            writer = encoder.Int64Encoder(1, False, False)
            writer(parts.append, self.benchmark_start_time_us)
        if self.story_run_time_us is not None:
            writer = encoder.Int64Encoder(2, False, False)
            writer(parts.append, self.story_run_time_us)
        if self.benchmark_name is not None:
            writer = encoder.StringEncoder(3, False, False)
            writer(parts.append, self.benchmark_name)
        if self.benchmark_description is not None:
            writer = encoder.StringEncoder(4, False, False)
            writer(parts.append, self.benchmark_description)
        if self.label is not None:
            writer = encoder.StringEncoder(5, False, False)
            writer(parts.append, self.label)
        if self.story_name is not None:
            writer = encoder.StringEncoder(6, False, False)
            writer(parts.append, self.story_name)
        if self.story_tags is not None:
            writer = encoder.StringEncoder(7,
                                           is_repeated=True,
                                           is_packed=False)
            writer(parts.append, self.story_tags)
        if self.story_run_index is not None:
            writer = encoder.Int32Encoder(8, False, False)
            writer(parts.append, self.story_run_index)
        if self.had_failures is not None:
            writer = encoder.BoolEncoder(9, False, False)
            writer(parts.append, self.had_failures)

        return b"".join(parts)
Beispiel #2
0
    def encode(self):
        parts = []
        if self.name_iid is not None:
            writer = encoder.UInt32Encoder(1, False, False)
            writer(parts.append, self.name_iid)
        if self.phase is not None:
            writer = encoder.Int32Encoder(2, False, False)
            writer(parts.append, self.phase)

        return b"".join(parts)