Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
heinrian committed Jul 16, 2024
1 parent b9a0d44 commit c1ccf18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions libiotrace/src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3312,11 +3312,14 @@ void power_measurement_step(void) {

#ifdef WITH_MPI_IO
if (mpi_node_rank == 0 || mpi_node_rank == -1) {
LOG_DEBUG("RUN STEP on Hostname: %s, World Rank: %d. Node Rank: %d\n", hostname,mpi_world_rank, mpi_node_rank);
#endif
uint64_t diff = gettime() - last_time;
if (diff > POWER_MEASUREMENT_INTERVAL) {

#ifdef WITH_MPI_IO
LOG_DEBUG("RUN STEP on Hostname: %s, World Rank: %d. Node Rank: %d\n", hostname,mpi_world_rank, mpi_node_rank);
#endif

#ifdef ENABLE_POWER_MEASUREMENT_RAPL
rapl_measurement();
#endif
Expand Down Expand Up @@ -4186,14 +4189,13 @@ int powercap_open_file(unsigned int offset) {
int fd = 0;
if (powercap_fd_array[offset].open == 0) {
fd = CALL_REAL_POSIX_SYNC(open)(pwoercap_file_path_array[offset], O_SYNC|O_RDONLY);
//fd = CALL_REAL_POSIX_SYNC(open)(pwoercap_file_path_array[offset], O_SYNC|component_sys_flags[powercap_cpu_measurement_tasks[offset].offset_in_file]);
if (fd > 0) {
powercap_fd_array[offset].file_descriptor = fd;
powercap_fd_array[offset].open = 1;

//LOG_DEBUG("Open File %3d: %3u => %s", fd, offset, pwoercap_file_path_array[offset]);
} else {
LOG_WARN("\n\n\n-------ERROR------\nCant open File for id: %3u\nFile: %s\nFile Descriptor: %d (%d)\nFlags: %d", offset, pwoercap_file_path_array[offset] , fd, errno, O_SYNC|component_sys_flags[powercap_cpu_measurement_tasks[offset].offset_in_file]);
LOG_WARN("\n\n\n-------ERROR------\nCant open File for id: %3u\nFile: %s\nFile Descriptor: %d (%d)", offset, pwoercap_file_path_array[offset] , fd, errno);
}
} else {
fd = powercap_fd_array[offset].file_descriptor;
Expand Down
1 change: 0 additions & 1 deletion libiotrace/src/power_measurement/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ static mode_t pkg_sys_flags[PKG_NUM_EVENTS] = {O_RDONLY, O_RDONLY, O_RDONLY,
static int component_events[COMPONENT_NUM_EVENTS] = {COMPONENT_ENERGY, COMPONENT_MAX_ENERGY_RANGE, COMPONENT_MAX_POWER_A, COMPONENT_POWER_LIMIT_A, COMPONENT_TIME_WINDOW_A, COMPONENT_ENABLED, COMPONENT_NAME};
static char *component_event_names[COMPONENT_NUM_EVENTS] = {"ENERGY_UJ", "MAX_ENERGY_RANGE_UJ", "MAX_POWER_A_UW", "POWER_LIMIT_A_UW", "TIME_WINDOW_A_US", "ENABLED", "NAME"};
static char *component_sys_names[COMPONENT_NUM_EVENTS] = {"energy_uj", "max_energy_range_uj", "constraint_0_max_power_uw", "constraint_0_power_limit_uw", "constraint_0_time_window_us", "enabled", "name"};
static mode_t component_sys_flags[COMPONENT_NUM_EVENTS] = {O_RDONLY, O_RDONLY, O_RDONLY, O_RDWR, O_RDONLY, O_RDONLY, O_RDONLY};

#define POWERCAP_MAX_COUNTERS (3 * (PKG_NUM_EVENTS + (3 * COMPONENT_NUM_EVENTS)))

Expand Down

0 comments on commit c1ccf18

Please sign in to comment.