From 36436a608fff2fd521e78091716d83461c58b8ac Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Mon, 17 Jun 2013 11:39:17 -0700 Subject: [PATCH] Convert enum to string --- src/common/slurm_acct_gather_profile.c | 30 +++++++++++++++++++++++++- src/common/slurm_acct_gather_profile.h | 2 ++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/common/slurm_acct_gather_profile.c b/src/common/slurm_acct_gather_profile.c index 2932a385299..2d3e5a1b1d3 100644 --- a/src/common/slurm_acct_gather_profile.c +++ b/src/common/slurm_acct_gather_profile.c @@ -120,7 +120,8 @@ static void *_timer_thread(void *args) if (!acct_gather_profile_timer[i].freq || (diff < acct_gather_profile_timer[i].freq)) continue; - debug2("profile signalling type %d", i); + debug2("profile signalling type %s", + acct_gather_profile_type_t_name(i)); /* signal poller to start */ slurm_mutex_lock(&acct_gather_profile_timer[i]. @@ -281,6 +282,33 @@ extern uint32_t acct_gather_profile_type_from_string(char *series_str) return ACCT_GATHER_PROFILE_NOT_SET; } +extern char *acct_gather_profile_type_t_name(acct_gather_profile_type_t type) +{ + switch (type) { + case PROFILE_ENERGY: + return "Energy"; + break; + case PROFILE_TASK: + return "Task"; + break; + case PROFILE_FILESYSTEM: + return "Lustre"; + break; + case PROFILE_NETWORK: + return "Network"; + break; + case PROFILE_CNT: + return "CNT?"; + break; + default: + fatal("Unhandled profile option %d please update " + "slurm_acct_gather_profile.c " + "(acct_gather_profile_type_t_name)", type); + } + + return "Unknown"; +} + extern int acct_gather_profile_startpoll(char *freq, char *freq_def) { int retval = SLURM_SUCCESS; diff --git a/src/common/slurm_acct_gather_profile.h b/src/common/slurm_acct_gather_profile.h index c83531cca1b..3864894bb45 100644 --- a/src/common/slurm_acct_gather_profile.h +++ b/src/common/slurm_acct_gather_profile.h @@ -103,6 +103,8 @@ extern uint32_t acct_gather_profile_from_string(char *profile_str); extern char *acct_gather_profile_type_to_string(uint32_t series); extern uint32_t acct_gather_profile_type_from_string(char *series_str); +extern char *acct_gather_profile_type_t_name(acct_gather_profile_type_t type); + extern int acct_gather_profile_startpoll(char *freq, char *freq_def); /* -- GitLab