Skip to content

Commit 59cbb4a

Browse files
committed
separate func for end record
1 parent cb27fc0 commit 59cbb4a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Lib/profiling/sampling/jsonl_collector.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,7 @@ def export(self, filename):
7171
self._write_chunked_defs(output, "str_def", self._strings)
7272
self._write_chunked_defs(output, "frame_def", self._frames)
7373
self._write_chunked_agg(output, self._iter_agg_entries())
74-
self._write_message(
75-
output,
76-
{
77-
"type": "end",
78-
"v": 1,
79-
"run_id": self.run_id,
80-
"samples_total": self._samples_total,
81-
},
82-
)
74+
self._write_message(output, self._build_end_record())
8375

8476
def _build_meta_record(self):
8577
record = {
@@ -94,6 +86,16 @@ def _build_meta_record(self):
9486

9587
return record
9688

89+
def _build_end_record(self):
90+
record = {
91+
"type": "end",
92+
"v": 1,
93+
"run_id": self.run_id,
94+
"samples_total": self._samples_total,
95+
}
96+
97+
return record
98+
9799
def _get_or_create_frame_id(self, filename, location, funcname):
98100
synthetic = location is None
99101
location_fields = self._normalize_export_location(location)

0 commit comments

Comments
 (0)