aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--comparison_report.c15
-rw-r--r--compiler.h39
-rw-r--r--csv_report.c33
-rw-r--r--default_report.c71
-rw-r--r--idlestat.c8
6 files changed, 118 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index af22abe..4c658d7 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@
# Daniel Lezcano <daniel.lezcano@linaro.org>
# Zoran Markovic <zoran.markovic@linaro.org>
#
-CFLAGS?=-g -Wall
+CFLAGS?=-g -Wall -Wunused-parameter
CC=gcc
TRACE_OBJS = tracefile_idlestat.o tracefile_ftrace.o \
diff --git a/comparison_report.c b/comparison_report.c
index c8444f5..e749c19 100644
--- a/comparison_report.c
+++ b/comparison_report.c
@@ -35,6 +35,7 @@
#include "report_ops.h"
#include "idlestat.h"
#include "utils.h"
+#include "compiler.h"
struct compare_report_data {
struct cpuidle_cstate *curr_cstate_baseline;
@@ -78,7 +79,7 @@ static int compare_check_options(struct program_options *options)
return 0;
}
-static void * compare_alloc_data(struct program_options *options)
+static void * compare_alloc_data(UNUSED struct program_options *options)
{
struct compare_report_data *ret = calloc(sizeof(*ret), 1);
@@ -94,7 +95,8 @@ static void compare_release_data(void *data)
}
-static void compare_cstate_single_state(struct cpuidle_cstate *c, void *report_data)
+static void compare_cstate_single_state(struct cpuidle_cstate *c,
+ void *report_data)
{
struct cpuidle_cstate empty;
struct cpuidle_cstate diff;
@@ -166,7 +168,8 @@ static void compare_cstate_single_state(struct cpuidle_cstate *c, void *report_d
printf("\n");
}
-static void compare_set_baseline_cstate(struct cpuidle_cstate *b, void *report_data)
+static void compare_set_baseline_cstate(struct cpuidle_cstate *b,
+ void *report_data)
{
struct compare_report_data *rdata;
@@ -190,7 +193,8 @@ static void compare_cstate_end_cpu(void *report_data)
}
-static void compare_pstate_single_freq(struct cpufreq_pstate *p, void *report_data)
+static void compare_pstate_single_freq(struct cpufreq_pstate *p,
+ void *report_data)
{
struct cpufreq_pstate empty;
struct cpufreq_pstate diff;
@@ -258,7 +262,8 @@ static void compare_pstate_single_freq(struct cpufreq_pstate *p, void *report_da
printf("\n");
}
-static void compare_set_baseline_pstate(struct cpufreq_pstate *b, void *report_data)
+static void compare_set_baseline_pstate(struct cpufreq_pstate *b,
+ void *report_data)
{
struct compare_report_data *rdata;
diff --git a/compiler.h b/compiler.h
new file mode 100644
index 0000000..99691b4
--- /dev/null
+++ b/compiler.h
@@ -0,0 +1,39 @@
+/*
+ * compiler.h
+ *
+ * Copyright (C) 2015, Linaro Limited.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Contributors:
+ * Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
+ *
+ */
+#ifndef __COMPILER_H
+#define __COMPILER_H
+
+#ifdef __GNUC__ /* GCC */
+
+#define UNUSED __attribute__((unused))
+
+#else /* Defaults for unknown compilers */
+
+#define UNUSED /* */
+
+#endif
+
+#endif /* __COMPILER_H */
diff --git a/csv_report.c b/csv_report.c
index 629b544..2fd5410 100644
--- a/csv_report.c
+++ b/csv_report.c
@@ -32,34 +32,36 @@
#include "report_ops.h"
#include "idlestat.h"
#include "utils.h"
+#include "compiler.h"
-static int csv_check_output(struct program_options *options, void *report_data)
+static int csv_check_output(UNUSED struct program_options *options,
+ UNUSED void *report_data)
{
return 0;
}
-static int csv_open_report_file(char *path, void *report_data)
+static int csv_open_report_file(char *path, UNUSED void *report_data)
{
return redirect_stdout_to_file(path);
}
-static int csv_close_report_file(void *report_data)
+static int csv_close_report_file(UNUSED void *report_data)
{
return (fclose(stdout) == EOF) ? -1 : 0;
}
-static void csv_cstate_table_header(void *report_data)
+static void csv_cstate_table_header(UNUSED void *report_data)
{
printf("C-State Table\n");
printf("cluster,core,cpu,C-state,min (us),max (us),avg (us),total (us),hits,over,under\n");
}
-static void csv_cstate_table_footer(void *report_data)
+static void csv_cstate_table_footer(UNUSED void *report_data)
{
printf("\n\n");
}
-static void csv_cstate_cpu_header(const char *cpu, void *report_data)
+static void csv_cstate_cpu_header(const char *cpu, UNUSED void *report_data)
{
if (strstr(cpu, "cluster"))
printf("%s\n", cpu);
@@ -68,7 +70,8 @@ static void csv_cstate_cpu_header(const char *cpu, void *report_data)
else printf(",,%s\n", cpu);
}
-static void csv_cstate_single_state(struct cpuidle_cstate *c, void *report_data)
+static void csv_cstate_single_state(struct cpuidle_cstate *c,
+ UNUSED void *report_data)
{
printf(",,,%s,", c->name);
printf("%f,", c->min_time == DBL_MAX ? 0. : c->min_time);
@@ -78,22 +81,23 @@ static void csv_cstate_single_state(struct cpuidle_cstate *c, void *report_data)
printf("\n");
}
-static void csv_cstate_end_cpu(void *report_data)
+static void csv_cstate_end_cpu(UNUSED void *report_data)
{
}
-static void csv_pstate_table_header(void *report_data)
+static void csv_pstate_table_header(UNUSED void *report_data)
{
printf("P-State Table\n");
printf(",,,P-state (kHz),min (us),max (us),avg (us),total (us),hits\n");
}
-static void csv_pstate_table_footer(void *report_data)
+static void csv_pstate_table_footer(UNUSED void *report_data)
{
printf("\n\n");
}
-static void csv_pstate_single_freq(struct cpufreq_pstate *p, void *report_data)
+static void csv_pstate_single_freq(struct cpufreq_pstate *p,
+ UNUSED void *report_data)
{
printf(",,,%d,", p->freq);
printf("%f,", p->min_time == DBL_MAX ? 0. : p->min_time);
@@ -103,7 +107,7 @@ static void csv_pstate_single_freq(struct cpufreq_pstate *p, void *report_data)
printf("\n");
}
-static void csv_wakeup_table_header(void *report_data)
+static void csv_wakeup_table_header(UNUSED void *report_data)
{
printf("\n");
@@ -111,12 +115,13 @@ static void csv_wakeup_table_header(void *report_data)
printf("cluster,core,cpu,IRQ,Name,Count,early,late\n");
}
-static void csv_wakeup_table_footer(void *report_data)
+static void csv_wakeup_table_footer(UNUSED void *report_data)
{
printf("\n\n");
}
-static void csv_wakeup_single_irq(struct wakeup_irq *irqinfo, void *report_data)
+static void csv_wakeup_single_irq(struct wakeup_irq *irqinfo,
+ UNUSED void *report_data)
{
if (irqinfo->id != -1) {
printf(",,,%d,%s,%d,%d,%d\n",
diff --git a/default_report.c b/default_report.c
index 78b4e5b..c1fd9ed 100644
--- a/default_report.c
+++ b/default_report.c
@@ -32,6 +32,7 @@
#include "report_ops.h"
#include "idlestat.h"
#include "utils.h"
+#include "compiler.h"
static void charrep(char c, int count)
@@ -41,7 +42,8 @@ static void charrep(char c, int count)
printf("%c", c);
}
-static int default_check_output(struct program_options *options, void *report_data)
+static int default_check_output(struct program_options *options,
+ UNUSED void *report_data)
{
if (check_window_size() && !options->outfilename) {
fprintf(stderr, "The terminal must be at least "
@@ -51,12 +53,12 @@ static int default_check_output(struct program_options *options, void *report_da
return 0;
}
-static int default_open_report_file(char *path, void *report_data)
+static int default_open_report_file(char *path, UNUSED void *report_data)
{
return redirect_stdout_to_file(path);
}
-static int default_close_report_file(void *report_data)
+static int default_close_report_file(UNUSED void *report_data)
{
return (fclose(stdout) == EOF) ? -1 : 0;
}
@@ -64,7 +66,7 @@ static int default_close_report_file(void *report_data)
/* Topology headers for all tables (C-state/P-state/Wakeups) */
-static void boxless_cpu_header(const char *cpu, void *report_data)
+static void boxless_cpu_header(const char *cpu, UNUSED void *report_data)
{
/* No pipe characters and less aggressive indentions */
if (strstr(cpu, "cluster"))
@@ -89,11 +91,11 @@ static void default_cpu_header(const char *cpu, int len)
printf("\n");
}
-static void default_end_cpu(void *report_data)
+static void default_end_cpu(UNUSED void *report_data)
{
}
-static void boxless_end_cpu(void *report_data)
+static void boxless_end_cpu(UNUSED void *report_data)
{
printf("\n");
}
@@ -101,25 +103,27 @@ static void boxless_end_cpu(void *report_data)
/* C-states */
-static void boxless_cstate_table_header(void *report_data)
+static void boxless_cstate_table_header(UNUSED void *report_data)
{
/* Note: Data is right-aligned, so boxless headers are too */
printf(" C-state min max avg total hits over under\n");
}
-static void default_cstate_table_header(void *report_data)
+static void default_cstate_table_header(UNUSED void *report_data)
{
/* Note: Boxed header columns appear centered */
charrep('-', 80);
printf("\n| C-state | min | max | avg | total | hits | over | under |\n");
}
-static void default_cstate_cpu_header(const char *cpu, void *report_data)
+static void default_cstate_cpu_header(const char *cpu,
+ UNUSED void *report_data)
{
default_cpu_header(cpu, 80);
}
-static void boxless_cstate_single_state(struct cpuidle_cstate *c, void *report_data)
+static void boxless_cstate_single_state(struct cpuidle_cstate *c,
+ UNUSED void *report_data)
{
printf(" %8s ", c->name);
display_factored_time(c->min_time == DBL_MAX ? 0. :
@@ -131,10 +135,12 @@ static void boxless_cstate_single_state(struct cpuidle_cstate *c, void *report_d
printf(" ");
display_factored_time(c->duration, 8);
printf(" ");
- printf("%5d %5d %5d\n", c->nrdata, c->early_wakings, c->late_wakings);
+ printf("%5d %5d %5d\n", c->nrdata, c->early_wakings,
+ c->late_wakings);
}
-static void default_cstate_single_state(struct cpuidle_cstate *c, void *report_data)
+static void default_cstate_single_state(struct cpuidle_cstate *c,
+ UNUSED void *report_data)
{
printf("| %8s | ", c->name);
display_factored_time(c->min_time == DBL_MAX ? 0. :
@@ -146,15 +152,16 @@ static void default_cstate_single_state(struct cpuidle_cstate *c, void *report_d
printf(" | ");
display_factored_time(c->duration, 8);
printf(" | ");
- printf("%5d | %5d | %5d |\n", c->nrdata, c->early_wakings, c->late_wakings);
+ printf("%5d | %5d | %5d |\n", c->nrdata, c->early_wakings,
+ c->late_wakings);
}
-static void boxless_cstate_table_footer(void *report_data)
+static void boxless_cstate_table_footer(UNUSED void *report_data)
{
printf("\n");
}
-static void default_cstate_table_footer(void *report_data)
+static void default_cstate_table_footer(UNUSED void *report_data)
{
charrep('-', 80);
printf("\n\n");
@@ -163,13 +170,13 @@ static void default_cstate_table_footer(void *report_data)
/* P-states */
-static void boxless_pstate_table_header(void *report_data)
+static void boxless_pstate_table_header(UNUSED void *report_data)
{
/* Note: Data is right-aligned, so boxless headers are too */
printf(" P-state min max avg total hits\n");
}
-static void default_pstate_table_header(void *report_data)
+static void default_pstate_table_header(UNUSED void *report_data)
{
charrep('-', 64);
printf("\n");
@@ -178,12 +185,14 @@ static void default_pstate_table_header(void *report_data)
printf("| P-state | min | max | avg | total | hits |\n");
}
-static void default_pstate_cpu_header(const char *cpu, void *report_data)
+static void default_pstate_cpu_header(const char *cpu,
+ UNUSED void *report_data)
{
default_cpu_header(cpu, 64);
}
-static void boxless_pstate_single_freq(struct cpufreq_pstate *p, void *report_data)
+static void boxless_pstate_single_freq(struct cpufreq_pstate *p,
+ UNUSED void *report_data)
{
printf(" ");
display_factored_freq(p->freq, 8);
@@ -198,7 +207,8 @@ static void boxless_pstate_single_freq(struct cpufreq_pstate *p, void *report_da
printf(" %5d\n", p->count);
}
-static void default_pstate_single_freq(struct cpufreq_pstate *p, void *report_data)
+static void default_pstate_single_freq(struct cpufreq_pstate *p,
+ UNUSED void *report_data)
{
printf("| ");
display_factored_freq(p->freq, 8);
@@ -213,12 +223,12 @@ static void default_pstate_single_freq(struct cpufreq_pstate *p, void *report_da
printf(" | %5d |\n", p->count);
}
-static void boxless_pstate_table_footer(void *report_data)
+static void boxless_pstate_table_footer(UNUSED void *report_data)
{
printf("\n");
}
-static void default_pstate_table_footer(void *report_data)
+static void default_pstate_table_footer(UNUSED void *report_data)
{
charrep('-', 64);
printf("\n\n");
@@ -227,7 +237,7 @@ static void default_pstate_table_footer(void *report_data)
/* Wakeups */
-static void boxless_wakeup_table_header(void *report_data)
+static void boxless_wakeup_table_header(UNUSED void *report_data)
{
/*
* Note: Columns 1 and 2 are left-aligned, others are right-aligned.
@@ -236,7 +246,7 @@ static void boxless_wakeup_table_header(void *report_data)
printf(" IRQ Name Count early late\n");
}
-static void default_wakeup_table_header(void *report_data)
+static void default_wakeup_table_header(UNUSED void *report_data)
{
charrep('-', 55);
printf("\n");
@@ -245,12 +255,14 @@ static void default_wakeup_table_header(void *report_data)
printf("| IRQ | Name | Count | early | late |\n");
}
-static void default_wakeup_cpu_header(const char *cpu, void *report_data)
+static void default_wakeup_cpu_header(const char *cpu,
+ UNUSED void *report_data)
{
default_cpu_header(cpu, 55);
}
-static void boxless_wakeup_single_irq(struct wakeup_irq *irqinfo, void *report_data)
+static void boxless_wakeup_single_irq(struct wakeup_irq *irqinfo,
+ UNUSED void *report_data)
{
if (irqinfo->id != -1) {
printf(" %-3d %-15.15s %7d %7d %7d\n",
@@ -263,7 +275,8 @@ static void boxless_wakeup_single_irq(struct wakeup_irq *irqinfo, void *report_d
}
}
-static void default_wakeup_single_irq(struct wakeup_irq *irqinfo, void *report_data)
+static void default_wakeup_single_irq(struct wakeup_irq *irqinfo,
+ UNUSED void *report_data)
{
if (irqinfo->id != -1) {
printf("| %-3d | %-15.15s | %7d | %7d | %7d |\n",
@@ -276,12 +289,12 @@ static void default_wakeup_single_irq(struct wakeup_irq *irqinfo, void *report_d
}
}
-static void boxless_wakeup_table_footer(void *report_data)
+static void boxless_wakeup_table_footer(UNUSED void *report_data)
{
printf("\n");
}
-static void default_wakeup_table_footer(void *report_data)
+static void default_wakeup_table_footer(UNUSED void *report_data)
{
charrep('-', 55);
printf("\n\n");
diff --git a/idlestat.c b/idlestat.c
index 9c5d784..ddfbfe2 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -47,6 +47,7 @@
#include "energy_model.h"
#include "report_ops.h"
#include "trace_ops.h"
+#include "compiler.h"
#define IDLESTAT_VERSION "0.5"
#define USEC_PER_SEC 1000000
@@ -181,8 +182,13 @@ static int display_pstates(struct report_ops *ops, void *arg, void *baseline, ch
return 0;
}
-static int display_wakeup(struct report_ops *ops, void *arg, void *baseline, char *cpu, void *report_data)
+static int display_wakeup(struct report_ops *ops, void *arg, UNUSED void *baseline, char *cpu, void *report_data)
{
+ /*
+ * FIXME: This function is lacking comparison report support
+ * When adding the feature, remember to remove the UNUSED tag
+ * from baseline parameter.
+ */
int i;
bool cpu_header = false;
struct cpuidle_cstates *cstates = arg;