-
Notifications
You must be signed in to change notification settings - Fork 56
Add individual and total node duration measurements #1823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@knoellle what is your take on this? Should we give this a go now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
@@ -919,6 +926,8 @@ fn generate_execute_node_and_write_main_outputs( | |||
) | |||
.wrap_err(#cycle_error_message)? | |||
}; | |||
let cycle_duration = cycle_start.elapsed().expect("time ran backwards"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
cycler_structs | ||
.cycle_times | ||
.insert([ | ||
InsertionRule::InsertField { | ||
name: "total".to_string(), | ||
}, | ||
InsertionRule::AppendDataType { | ||
data_type: Type::Verbatim(quote! { std::time::Duration }), | ||
}, | ||
]) | ||
.map_err(|source| Error::Hierarchy { | ||
node: "total_cycle_node_timings".to_string(), | ||
cycler: cycler.name.clone(), | ||
source, | ||
})?; | ||
for node in cycler.iter_nodes() { | ||
cycler_structs | ||
.cycle_times | ||
.insert([ | ||
InsertionRule::InsertField { | ||
name: node.name.to_case(Case::Snake), | ||
}, | ||
InsertionRule::AppendDataType { | ||
data_type: Type::Verbatim(quote! { std::time::Duration }), | ||
}, | ||
]) | ||
.map_err(|source| Error::Hierarchy { | ||
node: node.name.clone(), | ||
cycler: cycler.name.clone(), | ||
source, | ||
})?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is duplicated (for total and then for all nodes). Can you use something like chain to have only one for loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled the field insertion out of the for loop and added another with iter::once().chain()
. Is this what you had in mind?
Why? What?
Debugging #1822 was kind of annoying without proper timing measurements for node and cycle durations.
This PR expands on #710 and adds the
cycle_timings
field to each cycler database. This includes a total time measurement from the start of the first node of a cycler until the last node's cycle function terminates, which is the same as the cycler recording timestamp. This can be used under$cycler.cycle_timings.total
.Same as #710 did, this also adds node cycle durations for each individual node of a cycler. These can be accessed under
$cycler.cycle_timings.$node
ToDo / Known Issues
If this is a WIP describe which problems are to be fixed.
Ideas for Next Iterations (Not This PR)
If there are some improvements that could be done in a next iteration, describe them here.
How to Test
$cycler.cycle_timings
in a twix text panel.