#![allow(non_camel_case_types)]
use libc::{uint64_t, c_double, c_int};
use hbs_common_sys::{heartbeat_udata, heartbeat_rates, heartbeat_window_state};
pub type heartbeat_pow_window_complete = Option<extern "C" fn(*const heartbeat_pow_context)>;
#[repr(C)]
pub struct heartbeat_pow_record {
pub id: uint64_t,
pub user_tag: uint64_t,
pub work: uint64_t,
pub wd: heartbeat_udata,
pub start_time: uint64_t,
pub end_time: uint64_t,
pub td: heartbeat_udata,
pub perf: heartbeat_rates,
pub start_energy: uint64_t,
pub end_energy: uint64_t,
pub ed: heartbeat_udata,
pub pwr: heartbeat_rates,
}
#[repr(C)]
pub struct heartbeat_pow_context {
pub ws: heartbeat_window_state,
pub window_buffer: *mut heartbeat_pow_record,
pub counter: uint64_t,
pub lock: c_int,
pub hwc_callback: heartbeat_pow_window_complete,
pub td: heartbeat_udata,
pub wd: heartbeat_udata,
pub ed: heartbeat_udata,
}
extern "C" {
pub fn heartbeat_pow_init(hb: *mut heartbeat_pow_context,
window_size: uint64_t,
window_buffer: *mut heartbeat_pow_record,
log_fd: c_int,
hwc_callback: heartbeat_pow_window_complete) -> c_int;
pub fn heartbeat_pow(hb: *mut heartbeat_pow_context,
user_tag: uint64_t,
work: uint64_t,
start_time: uint64_t,
end_time: uint64_t,
start_energy: uint64_t,
end_energy: uint64_t);
pub fn hb_pow_log_header(fd: c_int) -> c_int;
pub fn hb_pow_log_window_buffer(hb: *const heartbeat_pow_context,
fd: c_int) -> c_int;
pub fn hb_pow_get_window_size(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_log_fd(hb: *const heartbeat_pow_context) -> c_int;
pub fn hb_pow_get_user_tag(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_global_time(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_window_time(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_global_work(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_window_work(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_global_perf(hb: *const heartbeat_pow_context) -> c_double;
pub fn hb_pow_get_window_perf(hb: *const heartbeat_pow_context) -> c_double;
pub fn hb_pow_get_instant_perf(hb: *const heartbeat_pow_context) -> c_double;
pub fn hb_pow_get_global_energy(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_window_energy(hb: *const heartbeat_pow_context) -> uint64_t;
pub fn hb_pow_get_global_power(hb: *const heartbeat_pow_context) -> c_double;
pub fn hb_pow_get_window_power(hb: *const heartbeat_pow_context) -> c_double;
pub fn hb_pow_get_instant_power(hb: *const heartbeat_pow_context) -> c_double;
}