-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinux_hugetlb.rs
More file actions
26 lines (21 loc) · 789 Bytes
/
Copy pathlinux_hugetlb.rs
File metadata and controls
26 lines (21 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use tailslayer::{HedgedRuntime, HugePageSize, IdleStrategy, LinuxHardwareSpec, ReplicatedBuffer};
fn main() -> tailslayer::Result<()> {
// Adjust these host-specific settings to match your machine.
let hardware = LinuxHardwareSpec {
channel_bit: Some(8),
hugepage_size: HugePageSize::Size1GiB,
..LinuxHardwareSpec::new([11, 12])
};
let mut buffer = ReplicatedBuffer::<u8>::builder()
.capacity(1024)
.linux_hardware_spec(&hardware)
.build()?;
buffer.extend_from_slice(&[0x43, 0x44])?;
let runtime = HedgedRuntime::builder(buffer)
.linux_hardware_spec(&hardware)
.idle_strategy(IdleStrategy::Spin)
.build()?;
let value = runtime.read(1)?;
println!("value={value:#x}");
Ok(())
}