Consolidate process instruction execution timings to own struct

This commit is contained in:
Trent Nelson 2022-01-05 20:18:24 -07:00 committed by Trent Nelson
parent 72fc6096a0
commit 390ef0fbcd
4 changed files with 47 additions and 27 deletions

View File

@ -178,24 +178,35 @@ impl ReplaySlotStats {
i64 i64
), ),
( (
"execute_accessories_process_instruction_verify_caller_us", "execute_accessories_process_instructions_total_us",
self.execute_timings self.execute_timings
.execute_accessories .execute_accessories
.process_instruction_verify_caller_us, .process_instructions
.total_us,
i64 i64
), ),
( (
"execute_accessories_process_instruction_process_executable_chain_us", "execute_accessories_process_instructions_verify_caller_us",
self.execute_timings self.execute_timings
.execute_accessories .execute_accessories
.process_instruction_process_executable_chain_us, .process_instructions
.verify_caller_us,
i64 i64
), ),
( (
"execute_accessories_process_instruction_verify_callee_us", "execute_accessories_process_instructions_process_executable_chain_us",
self.execute_timings self.execute_timings
.execute_accessories .execute_accessories
.process_instruction_verify_callee_us, .process_instructions
.process_executable_chain_us,
i64
),
(
"execute_accessories_process_instructions_verify_callee_us",
self.execute_timings
.execute_accessories
.process_instructions
.verify_callee_us,
i64 i64
), ),
); );

View File

@ -804,7 +804,8 @@ impl<'a> InvokeContext<'a> {
saturating_add_assign!( saturating_add_assign!(
timings timings
.execute_accessories .execute_accessories
.process_instruction_verify_caller_us, .process_instructions
.verify_caller_us,
verify_caller_time.as_us() verify_caller_time.as_us()
); );
verify_caller_result?; verify_caller_result?;
@ -855,13 +856,15 @@ impl<'a> InvokeContext<'a> {
saturating_add_assign!( saturating_add_assign!(
timings timings
.execute_accessories .execute_accessories
.process_instruction_process_executable_chain_us, .process_instructions
.process_executable_chain_us,
process_executable_chain_time.as_us() process_executable_chain_time.as_us()
); );
saturating_add_assign!( saturating_add_assign!(
timings timings
.execute_accessories .execute_accessories
.process_instruction_verify_callee_us, .process_instructions
.verify_callee_us,
verify_callee_time.as_us() verify_callee_time.as_us()
); );

View File

@ -64,6 +64,26 @@ impl ExecuteTimings {
} }
} }
#[derive(Default, Debug)]
pub struct ExecuteProcessInstructionTimings {
pub total_us: u64,
pub verify_caller_us: u64,
pub process_executable_chain_us: u64,
pub verify_callee_us: u64,
}
impl ExecuteProcessInstructionTimings {
pub fn accumulate(&mut self, other: &ExecuteProcessInstructionTimings) {
saturating_add_assign!(self.total_us, other.total_us);
saturating_add_assign!(self.verify_caller_us, other.verify_caller_us);
saturating_add_assign!(
self.process_executable_chain_us,
other.process_executable_chain_us
);
saturating_add_assign!(self.verify_callee_us, other.verify_callee_us);
}
}
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct ExecuteAccessoryTimings { pub struct ExecuteAccessoryTimings {
pub feature_set_clone_us: u64, pub feature_set_clone_us: u64,
@ -71,10 +91,7 @@ pub struct ExecuteAccessoryTimings {
pub get_executors_us: u64, pub get_executors_us: u64,
pub process_message_us: u64, pub process_message_us: u64,
pub update_executors_us: u64, pub update_executors_us: u64,
pub process_instructions_us: u64, pub process_instructions: ExecuteProcessInstructionTimings,
pub process_instruction_verify_caller_us: u64,
pub process_instruction_process_executable_chain_us: u64,
pub process_instruction_verify_callee_us: u64,
} }
impl ExecuteAccessoryTimings { impl ExecuteAccessoryTimings {
@ -90,19 +107,8 @@ impl ExecuteAccessoryTimings {
saturating_add_assign!(self.get_executors_us, other.get_executors_us); saturating_add_assign!(self.get_executors_us, other.get_executors_us);
saturating_add_assign!(self.process_message_us, other.process_message_us); saturating_add_assign!(self.process_message_us, other.process_message_us);
saturating_add_assign!(self.update_executors_us, other.update_executors_us); saturating_add_assign!(self.update_executors_us, other.update_executors_us);
saturating_add_assign!(self.process_instructions_us, other.process_instructions_us); self.process_instructions
saturating_add_assign!( .accumulate(&other.process_instructions);
self.process_instruction_verify_caller_us,
other.process_instruction_verify_caller_us
);
saturating_add_assign!(
self.process_instruction_process_executable_chain_us,
other.process_instruction_process_executable_chain_us
);
saturating_add_assign!(
self.process_instruction_verify_callee_us,
other.process_instruction_verify_callee_us
);
} }
} }

View File

@ -146,7 +146,7 @@ impl MessageProcessor {
); );
timings.details.accumulate(&invoke_context.timings); timings.details.accumulate(&invoke_context.timings);
saturating_add_assign!( saturating_add_assign!(
timings.execute_accessories.process_instructions_us, timings.execute_accessories.process_instructions.total_us,
time.as_us() time.as_us()
); );
result result