Skip to content

Commit f3a3a13

Browse files
kalutesV8 LUCI CQ
authored andcommitted
Add textproto output for trace summaries
In addition to binary protobuf, also export the more human friendly .textproto format of the trace summary. Additionally fix the naming of the binary trace summary file to be '.pb'. Change-Id: I3b68abffbca45e2ab95e8ae602d0f8c548d9f08b Reviewed-on: https://chromium-review.googlesource.com/c/crossbench/+/6666724 Reviewed-by: Charles Dick <[email protected]> Commit-Queue: Kameron Lutes <[email protected]>
1 parent 20b9269 commit f3a3a13

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crossbench/probes/perfetto/trace_processor/trace_processor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from typing import TYPE_CHECKING, Iterable, Optional, Self, Type
1212

1313
import pandas as pd
14+
from google.protobuf import text_format
1415
from google.protobuf.json_format import MessageToJson
1516
from perfetto.batch_trace_processor.api import (BatchTraceProcessor,
1617
BatchTraceProcessorConfig)
@@ -461,12 +462,13 @@ def _summarize_trace(self, tp: TraceProcessor) -> ProbeResult:
461462
proto_result = tp.trace_summary(
462463
specs=list(self.probe.metric_definitions), metric_ids=metric_ids)
463464

464-
proto_file = self.local_result_path / "v2_metrics.proto"
465+
proto_file = self.local_result_path / "v2_metrics.pb"
466+
proto_file.write_bytes(proto_result.SerializeToString())
465467

466-
with proto_file.open("wb") as f:
467-
f.write(proto_result.SerializeToString())
468+
textproto_file = self.local_result_path / "v2_metrics.textproto"
469+
textproto_file.write_bytes(text_format.MessageToBytes(proto_result))
468470

469-
return LocalProbeResult(file=[proto_file])
471+
return LocalProbeResult(file=[proto_file, textproto_file])
470472

471473

472474
@property

0 commit comments

Comments
 (0)