Skip to content

Commit

Permalink
Add comments for eager macros
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Jul 1, 2022
1 parent 85d3de0 commit d8552c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/progress_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ impl ReplaySlotStats {
("bank_complete_time_us", bank_complete_time_us, i64),
("total_entries", num_entries as i64, i64),
("total_shreds", num_shreds as i64, i64),
// Everything inside the `eager!` block will be eagerly expanded before
// evaluation of the rest of the surrounding macro.
eager!{report_execute_timings!(self.execute_timings)}
);
};
Expand Down
5 changes: 5 additions & 0 deletions program-runtime/src/timings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ impl core::fmt::Debug for Metrics {
}
}

// The auxiliary variable that must always be provided to eager_macro_rules! must use the
// identifier `eager_1`. Macros declared with `eager_macro_rules!` can then be used inside
// an eager! block.
eager_macro_rules! { $eager_1
#[macro_export]
macro_rules! report_execute_timings {
Expand Down Expand Up @@ -299,6 +302,8 @@ impl ThreadExecuteTimings {
("slot", slot as i64, i64),
("total_thread_us", self.total_thread_us as i64, i64),
("total_transactions_executed", self.total_transactions_executed as i64, i64),
// Everything inside the `eager!` block will be eagerly expanded before
// evaluation of the rest of the surrounding macro.
eager!{report_execute_timings!(self.execute_timings)}
);
};
Expand Down

0 comments on commit d8552c5

Please sign in to comment.