solana_program/
compute_units.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
/// Return the remaining compute units the program may consume
#[inline]
pub fn sol_remaining_compute_units() -> u64 {
    #[cfg(target_os = "solana")]
    unsafe {
        crate::syscalls::sol_remaining_compute_units()
    }

    #[cfg(not(target_os = "solana"))]
    {
        crate::program_stubs::sol_remaining_compute_units()
    }
}