Make use of hwmon_ctx_t

This commit is contained in:
jsteube
2016-09-28 22:28:44 +02:00
parent fdd48b52ec
commit 7191780296
10 changed files with 755 additions and 917 deletions
+15 -35
View File
@@ -6,41 +6,21 @@
#ifndef _HWMON_H
#define _HWMON_H
int get_adapters_num_adl (void *adl, int *iNumberAdapters);
int hm_get_threshold_slowdown_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_threshold_shutdown_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_temperature_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanpolicy_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanspeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_buslanes_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_utilization_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_memoryspeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_corespeed_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_throttle_with_device_id (const hwmon_ctx_t *hwmon_ctx, const opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_set_fanspeed_with_device_id_adl (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_nvapi (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_xnvctrl (const hwmon_ctx_t *hwmon_ctx, const uint device_id, const int fanspeed);
int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
int hm_get_adapter_index_nvapi (HM_ADAPTER_NVAPI nvapiGPUHandle[DEVICES_MAX]);
int hm_get_adapter_index_nvml (HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX]);
LPAdapterInfo hm_get_adapter_info_adl (void *adl, int iNumberAdapters);
u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
// int hm_get_device_num (void *adl, HM_ADAPTER_ADL hm_adapter_index, int *hm_device_num);
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
int hm_get_threshold_slowdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_threshold_shutdown_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_temperature_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_fanpolicy_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_buslanes_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_utilization_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_memoryspeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_corespeed_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_get_throttle_with_device_id (opencl_ctx_t *opencl_ctx, const uint device_id);
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fanspeed, const int fanpolicy);
int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed);
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options);
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx);
int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx);
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx);
#endif // _HWMON_H
+2 -2
View File
@@ -11,8 +11,8 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_display (opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);
+7 -12
View File
@@ -809,8 +809,8 @@ typedef struct
int od_version;
int fan_get_supported;
int fan_set_supported;
bool fan_get_supported;
bool fan_set_supported;
} hm_attrs_t;
@@ -1210,6 +1210,11 @@ typedef struct
hm_attrs_t *hm_device;
ADLOD6MemClockState *od_clock_mem_status;
int *od_power_control_status;
unsigned int *nvml_power_limit;
} hwmon_ctx_t;
typedef struct
@@ -1245,16 +1250,6 @@ typedef struct
u32 shutdown_inner;
u32 shutdown_outer;
/**
* hardware watchdog
*/
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t hm_device[DEVICES_MAX];
/**
* crack-per-time
*/