summaryrefslogtreecommitdiff
path: root/yjit/src/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'yjit/src/stats.rs')
-rw-r--r--yjit/src/stats.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index 05e970702c..5d32f613c8 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -141,6 +141,19 @@ macro_rules! make_counters {
}
}
+/// Macro to increase a counter by name and count
+macro_rules! incr_counter_by {
+ // Unsafe is ok here because options are initialized
+ // once before any Ruby code executes
+ ($counter_name:ident, $count:expr) => {
+ #[allow(unused_unsafe)]
+ {
+ unsafe { $crate::stats::COUNTERS.$counter_name += $count as u64 }
+ }
+ };
+}
+pub(crate) use incr_counter_by;
+
/// Macro to increment a counter by name
macro_rules! incr_counter {
// Unsafe is ok here because options are initialized