@@ -196,6 +196,8 @@ def test_read_jitlog_counter():
196196 ta .start_mark (const .MARK_TRACE_ASM )
197197 op = FlatOp (0 , 'hello' , '' , '?' , 0 , 2 )
198198 ta .add_instr (op )
199+ op2 = FlatOp (0 , 'increment_debug_counter' , '' , '?' , 0 , 2 )
200+ ta .add_instr (op2 )
199201 tb = forest .add_trace ('bridge' , 22 , 101 )
200202 fw = FileObjWrapper (FileObj ([encode_le_u64 (0x0 ), b'l' , encode_le_u64 (20 )]))
201203 assert marks .read_jitlog_counter (forest , None , fw ) == False , \
@@ -209,7 +211,7 @@ def test_read_jitlog_counter():
209211 assert marks .read_jitlog_counter (forest , None , fw ) == True
210212 assert marks .read_jitlog_counter (forest , None , fw ) == True
211213 assert ta .counter == 145
212- assert ta .point_counters [0 ] == 45
214+ assert ta .point_counters [1 ] == 45
213215 assert tb .counter == 100
214216
215217def test_point_in_trace ():
@@ -220,10 +222,11 @@ def test_point_in_trace():
220222 trace .add_instr (op )
221223 trace .add_up_enter_count (10 )
222224 point_in_trace = forest .get_point_in_trace_by_descr (1 )
225+ point_in_trace .set_inc_op (FakeOp (1 ))
223226 point_in_trace .add_up_enter_count (20 )
224227
225228 assert trace .counter == 10
226- assert trace .point_counters [0 ] == 20
229+ assert trace .point_counters [1 ] == 20
227230
228231class FakeOp (object ):
229232 def __init__ (self , i ):
@@ -233,16 +236,18 @@ def test_counter_points():
233236 forest = TraceForest (1 )
234237 trace = forest .add_trace ('loop' , 0 , 0 )
235238 d = trace .get_counter_points ()
236- assert d ['enter' ] == 0
239+ assert d [0 ] == 0
237240 assert len (d ) == 1
238241 trace .counter = 100
239242 d = trace .get_counter_points ()
240- assert d ['enter' ] == 100
243+ assert d [0 ] == 100
241244 assert len (d ) == 1
242245 pit = PointInTrace (trace , FakeOp (10 ))
243- pit .add_up_enter_count (55 )
246+ assert not pit .add_up_enter_count (55 )
247+ pit .set_inc_op (FakeOp (11 ))
248+ assert pit .add_up_enter_count (55 )
244249 d = trace .get_counter_points ()
245- assert d [10 ] == 55
250+ assert d [11 ] == 55
246251 assert len (d ) == 2
247252
248253def test_32bit_log_header ():
0 commit comments