From f8c754fc9e7f3895e83a6e8a704cbe7a334f6c92 Mon Sep 17 00:00:00 2001 From: Stephanie Brink Date: Tue, 19 Mar 2024 11:18:40 -0700 Subject: [PATCH] format headers --- src/variorum/Intel/intel_power_features.h | 280 +++++++++++++--------- src/variorum/Intel/thermal_features.h | 108 ++++++--- src/variorum/Intel/variorum_cpuid.h | 12 +- 3 files changed, 249 insertions(+), 151 deletions(-) diff --git a/src/variorum/Intel/intel_power_features.h b/src/variorum/Intel/intel_power_features.h index 399b6dcbc..872902a26 100644 --- a/src/variorum/Intel/intel_power_features.h +++ b/src/variorum/Intel/intel_power_features.h @@ -174,96 +174,136 @@ int get_package_power_limits(struct rapl_units *ru, off_t msr); #endif -int get_rapl_power_unit(struct rapl_units *ru, - off_t msr); - -void print_package_power_limit(FILE *writedest, - off_t msr_power_limit, - off_t msr_rapl_unit, - int socket); - -void print_dram_power_limit(FILE *writedest, - off_t msr_power_limit, - off_t msr_rapl_unit, - int socket); - -void print_verbose_dram_power_limit(FILE *writedest, - off_t msr_power_limit, - off_t msr_rapl_unit, - int socket); - -int get_package_rapl_limit(const unsigned socket, - struct rapl_limit *limit1, - struct rapl_limit *limit2, - off_t msr_power_limit, - off_t msr_rapl_unit); - -int get_dram_rapl_limit(const unsigned socket, - struct rapl_limit *limit, - off_t msr_power_limit, - off_t msr_rapl_unit); - -void print_rapl_power_unit(FILE *writedest, - off_t msr); - -int get_rapl_pkg_power_info(const unsigned socket, - struct rapl_pkg_power_info *info, - off_t msr); - -int get_rapl_dram_power_info(const unsigned socket, - struct rapl_dram_power_info *info, - off_t msr); - -void print_package_power_info(FILE *writedest, - off_t msr, - int socket); - -void print_dram_power_info(FILE *writedest, - off_t msr, - int socket); - -void print_verbose_rapl_power_unit(FILE *writedest, - off_t msr); - -void print_verbose_package_power_limit(FILE *writedest, - off_t msr_power_limit, - off_t msr_rapl_unit, - int socket); - -void print_verbose_package_power_info(FILE *writedest, - off_t msr, - int socket); - -void print_verbose_dram_power_info(FILE *writedest, - off_t msr, - int socket); - -int cap_package_power_limit(const unsigned socket, - int package_power_limit, - off_t msr_power_limit, - off_t msr_rapl_unit); - -void print_power_data(FILE *writedest, - off_t msr_rapl_unit, - off_t msr_pkg_energy_status, - off_t msr_dram_energy_status); - -void print_verbose_power_data(FILE *writedest, - off_t msr_rapl_unit, - off_t msr_pkg_energy_status, - off_t msr_dram_energy_status); - -void json_get_power_data(json_t *get_power_obj, - off_t msr_power_limit, - off_t msr_rapl_unit, - off_t msr_pkg_energy_status, - off_t msr_dram_energy_status); - -void json_get_power_domain_info(json_t *get_domain_obj, - off_t msr_pkg_power_info, - off_t msr_dram_power_info, - off_t msr_rapl_unit, - off_t msr_power_limit); +int get_rapl_power_unit( + struct rapl_units *ru, + off_t msr +); + +void print_package_power_limit( + FILE *writedest, + off_t msr_power_limit, + off_t msr_rapl_unit, + int socket +); + +void print_dram_power_limit( + FILE *writedest, + off_t msr_power_limit, + off_t msr_rapl_unit, + int socket +); + +void print_verbose_dram_power_limit( + FILE *writedest, + off_t msr_power_limit, + off_t msr_rapl_unit, + int socket +); + +int get_package_rapl_limit( + const unsigned socket, + struct rapl_limit *limit1, + struct rapl_limit *limit2, + off_t msr_power_limit, + off_t msr_rapl_unit +); + +int get_dram_rapl_limit( + const unsigned socket, + struct rapl_limit *limit, + off_t msr_power_limit, + off_t msr_rapl_unit +); + +void print_rapl_power_unit( + FILE *writedest, + off_t msr +); + +int get_rapl_pkg_power_info( + const unsigned socket, + struct rapl_pkg_power_info *info, + off_t msr +); + +int get_rapl_dram_power_info( + const unsigned socket, + struct rapl_dram_power_info *info, + off_t msr +); + +void print_package_power_info( + FILE *writedest, + off_t msr, + int socket +); + +void print_dram_power_info( + FILE *writedest, + off_t msr, + int socket +); + +void print_verbose_rapl_power_unit( + FILE *writedest, + off_t msr +); + +void print_verbose_package_power_limit( + FILE *writedest, + off_t msr_power_limit, + off_t msr_rapl_unit, + int socket +); + +void print_verbose_package_power_info( + FILE *writedest, + off_t msr, + int socket +); + +void print_verbose_dram_power_info( + FILE *writedest, + off_t msr, + int socket +); + +int cap_package_power_limit( + const unsigned socket, + int package_power_limit, + off_t msr_power_limit, + off_t msr_rapl_unit +); + +void print_power_data( + FILE *writedest, + off_t msr_rapl_unit, + off_t msr_pkg_energy_status, + off_t msr_dram_energy_status +); + +void print_verbose_power_data( + FILE *writedest, + off_t msr_rapl_unit, + off_t msr_pkg_energy_status, + off_t msr_dram_energy_status +); + +void json_get_power_data( + json_t *get_power_obj, + off_t msr_power_limit, + off_t msr_rapl_unit, + off_t msr_pkg_energy_status, + off_t msr_dram_energy_status +); + +void json_get_power_domain_info( + json_t *get_domain_obj, + off_t msr_pkg_power_info, + off_t msr_dram_power_info, + off_t msr_rapl_unit, + off_t msr_power_limit +); /// @brief Store the RAPL data on the heap. /// @@ -271,7 +311,9 @@ void json_get_power_domain_info(json_t *get_domain_obj, /// from a given RAPL power domain. /// /// @return 0 if successful, else -1 if setflags() fails. -int rapl_storage(struct rapl_data **data); +int rapl_storage( + struct rapl_data **data +); /// @brief Read all available RAPL data for a given socket. /// @@ -280,9 +322,11 @@ int rapl_storage(struct rapl_data **data); /// @param [in] msr_dram_energy_status Unique MSR address for MSR_DRAM_ENERGY_STATUS. /// /// @return 0 if successful, else -1 if rapl_storage() fails. -int read_rapl_data(off_t msr_rapl_unit, - off_t msr_pkg_energy_status, - off_t msr_dram_energy_status); +int read_rapl_data( + off_t msr_rapl_unit, + off_t msr_pkg_energy_status, + off_t msr_dram_energy_status +); /// @brief Read RAPL data and compute difference in readings taken at two /// instances in time. @@ -292,30 +336,40 @@ int read_rapl_data(off_t msr_rapl_unit, /// @param [in] msr_dram_energy_status Unique MSR address for MSR_DRAM_ENERGY_STATUS. /// /// @return 0 if successful, else -1 if rapl_storage() fails. -int get_power(off_t msr_rapl_unit, - off_t msr_pkg_energy_status, - off_t msr_dram_energy_status); - -void get_all_power_data(FILE *writedest, - off_t msr_pkg_power_limit, - off_t msr_dram_power_limit, - off_t msr_rapl_unit, - off_t msr_package_energy_status, - off_t msr_dram_energy_status); +int get_power( + off_t msr_rapl_unit, + off_t msr_pkg_energy_status, + off_t msr_dram_energy_status +); + +void get_all_power_data( + FILE *writedest, + off_t msr_pkg_power_limit, + off_t msr_dram_power_limit, + off_t msr_rapl_unit, + off_t msr_package_energy_status, + off_t msr_dram_energy_status +); /// @brief Compute difference in readings taken at two instances in time. /// /// @return 0 if successful, else -1 if rapl_storage() fails. -int delta_rapl_data(off_t msr_rapl_unit); +int delta_rapl_data( + off_t msr_rapl_unit +); #endif ///* intel_power_features.h */ -//void pkg_energy_status(enum ctl_domains_e d, -// int id, -// off_t msr, -// double *val); -//void dram_energy_status(enum ctl_domains_e d, -// int id, -// off_t msr, -// double *val); +//void pkg_energy_status( +// enum ctl_domains_e d, +// int id, +// off_t msr, +// double *val +//); +//void dram_energy_status( +// enum ctl_domains_e d, +// int id, +// off_t msr, +// double *val +//); diff --git a/src/variorum/Intel/thermal_features.h b/src/variorum/Intel/thermal_features.h index 1853fb1ce..3f6171920 100644 --- a/src/variorum/Intel/thermal_features.h +++ b/src/variorum/Intel/thermal_features.h @@ -268,10 +268,12 @@ struct pkg_therm_stat /// @param [in] msr_therm_stat Unique MSR address for IA32_THERM_STATUS. /// @param [in] msr_pkg_therm_stat Unique MSR address for IA32_PACKAGE_THERM_STATUS. /// @param [in] msr_temp_target Unique MSR address for TEMPERATURE_TARGET. -int print_therm_temp_reading(FILE *writedest, - off_t msr_therm_stat, - off_t msr_pkg_therm_stat, - off_t msr_temp_target); +int print_therm_temp_reading( + FILE *writedest, + off_t msr_therm_stat, + off_t msr_pkg_therm_stat, + off_t msr_temp_target +); /// @brief Print only temperature data in long format. /// @@ -279,24 +281,30 @@ int print_therm_temp_reading(FILE *writedest, /// @param [in] msr_therm_stat Unique MSR address for IA32_THERM_STATUS. /// @param [in] msr_pkg_therm_stat Unique MSR address for IA32_PACKAGE_THERM_STATUS. /// @param [in] msr_temp_target Unique MSR address for TEMPERATURE_TARGET. -int print_verbose_therm_temp_reading(FILE *writedest, - off_t msr_therm_stat, - off_t msr_pkg_therm_stat, - off_t msr_temp_target); +int print_verbose_therm_temp_reading( + FILE *writedest, + off_t msr_therm_stat, + off_t msr_pkg_therm_stat, + off_t msr_temp_target +); /// @brief set json object string with temperature data -int get_therm_temp_reading_json(json_t *get_thermal_object, - off_t msr_therm_stat, - off_t msr_pkg_therm_stat, - off_t msr_temp_target); +int get_therm_temp_reading_json( + json_t *get_thermal_object, + off_t msr_therm_stat, + off_t msr_pkg_therm_stat, + off_t msr_temp_target +); /// @brief Read value of the IA32_PACKAGE_THERM_STATUS register and translate /// bit fields to human-readable values. /// /// @param [out] s Data for package-level thermal status. /// @param [in] msr Unique MSR address for IA32_PACKAGE_THERM_STATUS. -int get_pkg_therm_stat(struct pkg_therm_stat *s, - off_t msr); +int get_pkg_therm_stat( + struct pkg_therm_stat *s, + off_t msr +); /************************************/ /* MSR_TEMPERATURE_TARGET Functions */ @@ -307,8 +315,10 @@ int get_pkg_therm_stat(struct pkg_therm_stat *s, /// /// @param [out] s Data for target temperature. /// @param [in] msr Unique MSR address for TEMPERATURE_TARGET. -void get_temp_target(struct msr_temp_target *s, - off_t msr); +void get_temp_target( + struct msr_temp_target *s, + off_t msr +); /*********************************************/ /* Thermal Functions (Status and Interrupts) */ @@ -319,20 +329,26 @@ void get_temp_target(struct msr_temp_target *s, /// /// @param [out] s Data for per-core thermal status. /// @param [in] msr Unique MSR address for IA32_THERM_STATUS. -void get_therm_stat(struct therm_stat *s, - off_t msr); +void get_therm_stat( + struct therm_stat *s, + off_t msr +); ///// @brief Store the package-level thermal control data on the heap. ///// ///// @param [out] thermctlref Pointer to data for package-level thermal control. ///// ///// @return 0 if successful. -//int therm2_ctl_storage(uint64_t **thermctlref); +//int therm2_ctl_storage( +// uint64_t **thermctlref +//); // ///// @brief Read value of the MSR_THERM2_CTL register. ///// ///// @return 0 if successful, else 1 if read_msr_by_coord() fails. -//int get_pkg_therm2_ctl(void); +//int get_pkg_therm2_ctl( +// void +//); // ///// @brief Print out control settings for Thermal Monitor #2. ///// @@ -340,70 +356,96 @@ void get_therm_stat(struct therm_stat *s, ///// ///// @return 0 if successful, else return a value less than 0 if ///// therm2_ctl_storage() fails. -//int print_therm2_ctl(FILE *writedest); +//int print_therm2_ctl( +// FILE *writedest +//); // ///// @brief Set value for IA32_THERM_STATUS across all cores. ///// ///// @param [in] s Data for per-core thermal status. -//void set_therm_stat(struct therm_stat *s); +//void set_therm_stat( +// struct therm_stat *s +//); // ///// @brief Set value for IA32_PACKAGE_THERM_STATUS across all sockets. ///// ///// @param [in] s Data for package-level thermal status. -//void set_pkg_therm_stat(struct pkg_therm_stat *s); +//void set_pkg_therm_stat( +// struct pkg_therm_stat *s +//); // ///// @brief Print detailed thermal status and interrupt data. ///// ///// @param [in] writedest File stream where output will be written to. -//void print_therm_data_verbose(FILE *writedest); +//void print_therm_data_verbose( +// FILE *writedest +//); // ///// @brief Store the per-core thermal interrupt data on the heap. ///// ///// @param [out] ti Pointer to data for per-core thermal interrupts. -//void store_therm_interrupt(struct therm_interrupt **ti); +//void store_therm_interrupt( +// struct therm_interrupt **ti +//); // ///// @brief Store the package-level thermal interrupt data on the heap. ///// ///// @param [out] pi Pointer to data for package-level thermal interrupts. -//void store_pkg_therm_interrupt(struct pkg_therm_interrupt **pi); +//void store_pkg_therm_interrupt( +// struct pkg_therm_interrupt **pi +//); // ///// @brief Read value of the IA32_THERM_INTERRUPT register and translate bit ///// fields to human-readable values. ///// ///// @param [out] s Data for per-core thermal interrupts. -//void get_therm_interrupt(struct therm_interrupt *s); +//void get_therm_interrupt( +// struct therm_interrupt *s +//); // ///// @brief Read value of the IA32_PACKAGE_THERM_INTERRUPT register and ///// translate bit fields to human-readable values. ///// ///// @param [out] s Data for package-level thermal interrupts. -//void get_pkg_therm_interrupt(struct pkg_therm_interrupt *s); +//void get_pkg_therm_interrupt( +// struct pkg_therm_interrupt *s +//); // ///// @brief Set value for IA32_THERM_INTERRUPT across all cores. ///// ///// @param [in] s Data for per-core thermal interrupts. -//void set_therm_interrupt(struct therm_interrupt *s); +//void set_therm_interrupt( +// struct therm_interrupt *s +//); // ///// @brief Set value for IA32_PACKAGE_THERM_INTERRUPT across all sockets. ///// ///// @param [in] s Data for package-level thermal interrupts. -//void set_pkg_therm_interrupt(struct pkg_therm_interrupt *s); +//void set_pkg_therm_interrupt( +// struct pkg_therm_interrupt *s +//); // ///// @brief Print the label for the abbreviated thermal status and interrupt ///// data printout. ///// ///// @param [in] writedest File stream where output will be written to. -//void print_therm_data_terse_label(FILE *writedest); +//void print_therm_data_terse_label( +// FILE *writedest +//); // ///// @brief Print abbreviated thermal status and interrupt data. ///// ///// @param [in] writedest File stream where output will be written to. -//void print_therm_data_terse(FILE *writedest); +//void print_therm_data_terse( +// FILE *writedest +//); // ///// @brief Print the label for the detailed thermal status and interrupt data ///// printout. ///// ///// @param [in] writedest File stream where output will be written to. -//void print_therm_data_verbose_label(FILE *writedest); +//void print_therm_data_verbose_label( +// FILE *writedest +//); #endif diff --git a/src/variorum/Intel/variorum_cpuid.h b/src/variorum/Intel/variorum_cpuid.h index b9820e8a7..e2f17ca35 100644 --- a/src/variorum/Intel/variorum_cpuid.h +++ b/src/variorum/Intel/variorum_cpuid.h @@ -8,10 +8,12 @@ #include -void cpuid(uint64_t leaf, - uint64_t *rax, - uint64_t *rbx, - uint64_t *rcx, - uint64_t *rdx); +void cpuid( + uint64_t leaf, + uint64_t *rax, + uint64_t *rbx, + uint64_t *rcx, + uint64_t *rdx +); #endif