Skip to content

Commit 3320bf1

Browse files
committed
fix: add inline hint
Signed-off-by: Woshiluo Luo <[email protected]>
1 parent 4d22c45 commit 3320bf1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/value/riscv_pmu.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// This module implement prop value described in
2+
/// https://www.kernel.org/doc/Documentation/devicetree/bindings/perf/riscv%2Cpmu.yaml
13
use crate::buildin::*;
24

35
use serde::{Deserialize, Serialize};
@@ -20,63 +22,76 @@ pub struct EventToMhpmcounters<'a>(Matrix<'a, 3>);
2022
pub struct RawEventToMhpcounters<'a>(Matrix<'a, 5>);
2123

2224
impl EventToMhpmevent<'_> {
25+
#[inline(always)]
2326
pub fn len(&self) -> usize {
2427
self.0.len()
2528
}
2629

30+
#[inline(always)]
2731
pub fn is_empty(&self) -> bool {
2832
self.0.is_empty()
2933
}
3034

35+
#[inline(always)]
3136
pub fn get_event_id(&self, i: usize) -> u32 {
3237
u32::from_be(self.0.get(i)[0])
3338
}
3439

40+
#[inline(always)]
3541
pub fn get_selector_value(&self, i: usize) -> u64 {
3642
let current = self.0.get(i);
3743
((u32::from_be(current[1]) as u64) << 32) | (u32::from_be(current[2]) as u64)
3844
}
3945
}
4046

4147
impl EventToMhpmcounters<'_> {
48+
#[inline(always)]
4249
pub fn len(&self) -> usize {
4350
self.0.len()
4451
}
4552

53+
#[inline(always)]
4654
pub fn is_empty(&self) -> bool {
4755
self.0.is_empty()
4856
}
4957

58+
#[inline(always)]
5059
pub fn get_event_idx_range(&self, i: usize) -> RangeInclusive<u32> {
5160
let current = self.0.get(i);
5261
u32::from_be(current[0])..=u32::from_be(current[1])
5362
}
5463

64+
#[inline(always)]
5565
pub fn get_counter_bitmap(&self, i: usize) -> u32 {
5666
let current = self.0.get(i);
5767
u32::from_be(current[2])
5868
}
5969
}
6070

6171
impl RawEventToMhpcounters<'_> {
72+
#[inline(always)]
6273
pub fn len(&self) -> usize {
6374
self.0.len()
6475
}
6576

77+
#[inline(always)]
6678
pub fn is_empty(&self) -> bool {
6779
self.0.is_empty()
6880
}
6981

82+
#[inline(always)]
7083
pub fn get_event_idx_base(&self, i: usize) -> u64 {
7184
let current = self.0.get(i);
7285
((u32::from_be(current[0]) as u64) << 32) | (u32::from_be(current[1]) as u64)
7386
}
7487

88+
#[inline(always)]
7589
pub fn get_event_idx_mask(&self, i: usize) -> u64 {
7690
let current = self.0.get(i);
7791
((u32::from_be(current[2]) as u64) << 32) | (u32::from_be(current[3]) as u64)
7892
}
7993

94+
#[inline(always)]
8095
pub fn get_counter_bitmap(&self, i: usize) -> u32 {
8196
let current = self.0.get(i);
8297
u32::from_be(current[4])

0 commit comments

Comments
 (0)