@@ -1258,6 +1258,9 @@ impl MessageProcessor {
1258
1258
account_db,
1259
1259
ancestors,
1260
1260
) ;
1261
+ let pre_remaining_units = invoke_context. get_compute_meter ( ) . borrow ( ) . get_remaining ( ) ;
1262
+ let mut time = Measure :: start ( "execute_instruction" ) ;
1263
+
1261
1264
self . process_instruction ( program_id, & instruction. data , & mut invoke_context) ?;
1262
1265
Self :: verify (
1263
1266
message,
@@ -1272,6 +1275,14 @@ impl MessageProcessor {
1272
1275
invoke_context. is_feature_active ( & demote_program_write_locks:: id ( ) ) ,
1273
1276
) ?;
1274
1277
1278
+ time. stop ( ) ;
1279
+ let post_remaining_units = invoke_context. get_compute_meter ( ) . borrow ( ) . get_remaining ( ) ;
1280
+
1281
+ let program_timing = timings. per_program_timings . entry ( * program_id) . or_default ( ) ;
1282
+ program_timing. accumulated_us += time. as_us ( ) ;
1283
+ program_timing. accumulated_units += pre_remaining_units - post_remaining_units;
1284
+ program_timing. count += 1 ;
1285
+
1275
1286
timings. accumulate ( & invoke_context. timings ) ;
1276
1287
1277
1288
Ok ( ( ) )
@@ -1299,8 +1310,6 @@ impl MessageProcessor {
1299
1310
ancestors : & Ancestors ,
1300
1311
) -> Result < ( ) , TransactionError > {
1301
1312
for ( instruction_index, instruction) in message. instructions . iter ( ) . enumerate ( ) {
1302
- let mut time = Measure :: start ( "execute_instruction" ) ;
1303
- let pre_remaining_units = compute_meter. borrow ( ) . get_remaining ( ) ;
1304
1313
let instruction_recorder = instruction_recorders
1305
1314
. as_ref ( )
1306
1315
. map ( |recorders| recorders[ instruction_index] . clone ( ) ) ;
@@ -1323,14 +1332,6 @@ impl MessageProcessor {
1323
1332
ancestors,
1324
1333
)
1325
1334
. map_err ( |err| TransactionError :: InstructionError ( instruction_index as u8 , err) ) ;
1326
- time. stop ( ) ;
1327
- let post_remaining_units = compute_meter. borrow ( ) . get_remaining ( ) ;
1328
-
1329
- let program_id = instruction. program_id ( & message. account_keys ) ;
1330
- let program_timing = timings. per_program_timings . entry ( * program_id) . or_default ( ) ;
1331
- program_timing. accumulated_us += time. as_us ( ) ;
1332
- program_timing. accumulated_units += pre_remaining_units - post_remaining_units;
1333
- program_timing. count += 1 ;
1334
1335
1335
1336
err?;
1336
1337
}
0 commit comments