@@ -1598,8 +1598,10 @@ def test_timestamp_preservation_with_rle(self):
15981598class TestBinaryReplayToJsonl (BinaryFormatTestBase ):
15991599 """Tests for binary -> JSONL replay via convert_binary_to_format."""
16001600
1601- def _replay_to_jsonl (self , samples , interval = 1000 ):
1602- bin_path = self .create_binary_file (samples , interval = interval )
1601+ def _replay_to_jsonl (self , samples , interval = 1000 , mode = None ):
1602+ bin_path = self .create_binary_file (
1603+ samples , interval = interval , mode = mode
1604+ )
16031605 with tempfile .NamedTemporaryFile (suffix = ".jsonl" , delete = False ) as f :
16041606 jsonl_path = f .name
16051607 self .temp_files .append (jsonl_path )
@@ -1629,6 +1631,16 @@ def test_binary_replay_to_jsonl_basic(self):
16291631 self .assertEqual (len (frame_defs ), 1 )
16301632 self .assertEqual (frame_defs [0 ]["line" ], 99 )
16311633
1634+ def test_binary_replay_to_jsonl_preserves_mode (self ):
1635+ frame = make_frame ("hot.py" , 99 , "hot_func" )
1636+ records = self ._replay_to_jsonl (
1637+ [[make_interpreter (0 , [make_thread (1 , [frame ])])]],
1638+ mode = PROFILING_MODE_CPU ,
1639+ )
1640+
1641+ meta = next (record for record in records if record ["type" ] == "meta" )
1642+ self .assertEqual (meta ["mode" ], "cpu" )
1643+
16321644 def test_binary_replay_to_jsonl_rle_weight_propagation (self ):
16331645 """RLE-batched identical samples land as a single agg entry with the right total."""
16341646 frame = make_frame ("rle.py" , 42 , "rle_func" )
0 commit comments