Skip to content

Commit

Permalink
Merge "Fix for PID monitoring with config file."
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksinx authored and Gerrit Code Review committed Jun 5, 2017
2 parents d35722b + 32683f6 commit 06d858e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pqos/configs/mon_llc_pid_text.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#
################################################################################

# Select library OS interface
iface-os:

# Monitor LLC occupancy on for PID 1
monitor-pids: llc:1

Expand Down
3 changes: 3 additions & 0 deletions pqos/configs/mon_llc_pid_xml_file.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#
################################################################################

# Select library OS interface
iface-os:

# Monitor LLC occupancy for PID 1
monitor-pids: llc:1

Expand Down
25 changes: 22 additions & 3 deletions pqos/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ static int sel_reset_alloc = 0;
*/
static int sel_show_allocation_config = 0;

/**
* Selected library interface
*/
static int sel_interface = PQOS_INTER_MSR;

/**
* @brief Function to check if a value is already contained in a table
*
Expand Down Expand Up @@ -334,6 +339,18 @@ selfn_allocation_select(const char *arg)
selfn_strdup(&sel_allocation_profile, arg);
}

/**
* @brief Selects library OS interface
*
* @param arg not used
*/
static void
selfn_iface_os(const char *arg)
{
UNUSED_ARG(arg);
sel_interface = PQOS_INTER_OS;
}

/**
* @brief Opens configuration file and parses its contents
*
Expand Down Expand Up @@ -363,7 +380,8 @@ parse_config_file(const char *fname)
{"monitor-file:", selfn_monitor_file }, /**< -o */
{"monitor-file-type:", selfn_monitor_file_type }, /**< -u */
{"monitor-top-like:", selfn_monitor_top_like }, /**< -T */
{"reset-cat:", selfn_reset_alloc }, /**< -R */
{"reset-cat:", selfn_reset_alloc }, /**< -R */
{"iface-os:", selfn_iface_os }, /**< -I */
};
FILE *fp = NULL;
char cb[256];
Expand Down Expand Up @@ -652,7 +670,7 @@ int main(int argc, char **argv)
selfn_super_verbose_mode(NULL);
break;
case 'I':
cfg.interface = PQOS_INTER_OS;
selfn_iface_os(NULL);
break;
default:
printf("Unsupported option: -%c. "
Expand All @@ -666,13 +684,14 @@ int main(int argc, char **argv)
}
}

if (pid_flag == 1 && cfg.interface == PQOS_INTER_MSR) {
if (pid_flag == 1 && sel_interface == PQOS_INTER_MSR) {
printf("Error! OS interface option [-I] needed for PID"
" monitoring. Please re-run with the -I option.\n");
exit_val = EXIT_FAILURE;
goto error_exit_1;
}
cfg.verbose = sel_verbose_mode;
cfg.interface = sel_interface;
/**
* Set up file descriptor for message log
*/
Expand Down

0 comments on commit 06d858e

Please sign in to comment.