From 9bc38dbaec4de3e1a22e4aaa0965874c5f952fb4 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Wed, 7 Nov 2012 12:37:36 -0800 Subject: [PATCH] energy accounting clean up Remove some unused variables and minor reformatting to conform with Linux kernel coding standard --- .../rapl/acct_gather_energy_rapl.c | 20 +++++++++---------- .../cgroup/jobacct_gather_cgroup.c | 6 ------ .../linux/jobacct_gather_linux.c | 5 ----- src/sstat/sstat.c | 2 -- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/plugins/acct_gather_energy/rapl/acct_gather_energy_rapl.c b/src/plugins/acct_gather_energy/rapl/acct_gather_energy_rapl.c index f257e398148..42c8d604e32 100644 --- a/src/plugins/acct_gather_energy/rapl/acct_gather_energy_rapl.c +++ b/src/plugins/acct_gather_energy/rapl/acct_gather_energy_rapl.c @@ -113,7 +113,6 @@ const uint32_t plugin_version = 100; static int freq = 0; static acct_gather_energy_t *local_energy = NULL; static bool acct_gather_energy_shutdown = true; -static uint32_t last_time = 0; int pkg2cpu [MAX_PKGS] = {[0 ... MAX_PKGS-1] -1}; /* one cpu in the package */ int fd[MAX_PKGS] = {[0 ... MAX_PKGS-1] -1}; @@ -150,7 +149,8 @@ static ulong get_dram_energy(int pkg) return(dram_energy[pkg].val); } -static int open_msr(int core) { +static int open_msr(int core) +{ char msr_filename[BUFSIZ]; int fd; @@ -167,20 +167,20 @@ static int open_msr(int core) { return fd; } -static void hardware (void) { +static void hardware (void) +{ char buf[1024]; FILE *fd; int cpu, pkg; if ((fd = fopen("/proc/cpuinfo", "r")) == 0) - pexit("fopen"); + error("fopen"); while (0 != fgets(buf, 1024, fd)) { if (strncmp(buf, "processor", sizeof("processor") - 1) == 0) { sscanf(buf, "processor\t: %d", &cpu); continue; } - if (strncmp(buf, "physical id", sizeof("physical id") - 1) == 0) - { + if (!strncmp(buf, "physical id", sizeof("physical id") - 1)) { sscanf(buf, "physical id\t: %d", &pkg); if (pkg2cpu[pkg] == -1) nb_pkg++; @@ -194,11 +194,10 @@ static void hardware (void) { extern int acct_gather_energy_p_update_node_energy(void) { int rc = SLURM_SUCCESS; - int pkg, i; - int core = 0; + int i; double energy_units; ulong result; - double ret, ret_tmp; + double ret; acct_gather_energy_shutdown = false; if (!acct_gather_energy_shutdown) { @@ -242,8 +241,7 @@ extern int acct_gather_energy_p_update_node_energy(void) static void _get_joules_task(acct_gather_energy_t *energy) { - int rc, pkg, i; - int core = 0; + int i; double energy_units, power_units; ulong result; ulong max_power; diff --git a/src/plugins/jobacct_gather/cgroup/jobacct_gather_cgroup.c b/src/plugins/jobacct_gather/cgroup/jobacct_gather_cgroup.c index 2748f896807..1c66c30b156 100644 --- a/src/plugins/jobacct_gather/cgroup/jobacct_gather_cgroup.c +++ b/src/plugins/jobacct_gather/cgroup/jobacct_gather_cgroup.c @@ -116,8 +116,6 @@ static int pagesize = 0; static DIR *slash_proc = NULL; static pthread_mutex_t reading_mutex = PTHREAD_MUTEX_INITIALIZER; static int cpunfo_frequency = 0; -static int last_cpu = 0; -static uint32_t pre_jobacct_total_cputime = 0; static uint32_t step_sampled_cputime = 0; static slurm_cgroup_conf_t slurm_cgroup_conf; @@ -181,7 +179,6 @@ static int _get_sys_interface_freq_line(uint32_t cpu, char *filename, int num_read, fd; FILE *sys_fp = NULL; char freq_file[80]; - int cpunfo_frqline= 6; char cpunfo_line [128]; char cpufreq_line [10]; @@ -440,9 +437,6 @@ extern void jobacct_gather_p_poll_data( struct jobacctinfo *jobacct = NULL; static int processing = 0; long hertz; - char *act_cpufreq; - size_t act_cpufreq_size; - uint32_t user_act_cpufreq, system_act_cpufreq; char sbuf[72]; char *cpu_time, *memory_stat, *ptr; size_t cpu_time_size, memory_stat_size; diff --git a/src/plugins/jobacct_gather/linux/jobacct_gather_linux.c b/src/plugins/jobacct_gather/linux/jobacct_gather_linux.c index 93b33d541c5..273221e426f 100644 --- a/src/plugins/jobacct_gather/linux/jobacct_gather_linux.c +++ b/src/plugins/jobacct_gather/linux/jobacct_gather_linux.c @@ -102,7 +102,6 @@ static int pagesize = 0; static DIR *slash_proc = NULL; static pthread_mutex_t reading_mutex = PTHREAD_MUTEX_INITIALIZER; static int cpunfo_frequency = 0; -static int last_cpu = 0; /* Finally, pre-define all local routines. */ @@ -203,7 +202,6 @@ static int _get_sys_interface_freq_line(uint32_t cpu, char *filename, int num_read, fd; FILE *sys_fp = NULL; char freq_file[80]; - int cpunfo_frqline= 6; char cpunfo_line [128]; char cpufreq_line [10]; @@ -432,9 +430,6 @@ extern void jobacct_gather_p_poll_data( struct jobacctinfo *jobacct = NULL; static int processing = 0; long hertz; - char *act_cpufreq; - size_t act_cpufreq_size; - uint32_t user_act_cpufreq, system_act_cpufreq; char sbuf[72]; int energy_counted = 0; diff --git a/src/sstat/sstat.c b/src/sstat/sstat.c index f91bdb0e402..f04fcd2c7a3 100644 --- a/src/sstat/sstat.c +++ b/src/sstat/sstat.c @@ -92,8 +92,6 @@ int _do_stat(uint32_t jobid, uint32_t stepid, char *nodelist) int ntasks = 0; int tot_tasks = 0; hostlist_t hl = NULL; - uint32_t act_cpufreq = 0; - uint32_t consumed_energy = 0; debug("requesting info for job %u.%u", jobid, stepid); if ((rc = slurm_job_step_stat(jobid, stepid, nodelist, -- GitLab