diff options
author | Tuukka Tikkanen <tuukka.tikkanen@linaro.org> | 2014-12-03 07:55:16 +0200 |
---|---|---|
committer | Tuukka Tikkanen <tuukka.tikkanen@linaro.org> | 2014-12-05 09:52:38 +0200 |
commit | c34959098e06170bf6dfd69b5434ef2c0c3925b8 (patch) | |
tree | 0f9be4732a24acb6aed131fd780f90f5cc361f9b | |
parent | c7ba025bae5fd8a324dd3210c8c78c5991f67fc7 (diff) |
idlestat: Remove trace file format variable from options structure
Currently the options->format field is not used outside of the
idlestat_load() function. Make the variable local, as the usage
is local. This makes it easier load multiple traces during single
invocation of idlestat.
Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r-- | idlestat.c | 10 | ||||
-rw-r--r-- | idlestat.h | 1 |
2 files changed, 5 insertions, 6 deletions
@@ -972,6 +972,7 @@ struct cpuidle_datas *idlestat_load(struct program_options *options) size_t count = 0, start = 1; struct cpuidle_datas *datas; int ret; + enum formats format; f = fopen(options->filename, "r"); if (!f) { @@ -983,13 +984,13 @@ struct cpuidle_datas *idlestat_load(struct program_options *options) /* version line */ fgets(buffer, BUFSIZE, f); if (strstr(buffer, "idlestat")) { - options->format = IDLESTAT_HEADER; + format = IDLESTAT_HEADER; fgets(buffer, BUFSIZE, f); if (sscanf(buffer, "cpus=%u", &nrcpus) != 1) nrcpus = 0; fgets(buffer, BUFSIZE, f); } else if (strstr(buffer, "# tracer")) { - options->format = TRACE_CMD_HEADER; + format = TRACE_CMD_HEADER; while(!feof(f)) { if (buffer[0] != '#') break; @@ -1022,14 +1023,14 @@ struct cpuidle_datas *idlestat_load(struct program_options *options) datas->nrcpus = nrcpus; /* read c-state information */ - if (options->format == IDLESTAT_HEADER) + if (format == IDLESTAT_HEADER) datas->cstates = load_and_build_cstate_info(f, nrcpus); else datas->cstates = build_cstate_info(nrcpus); if (!datas->cstates) { free(datas); fclose(f); - if (options->format == IDLESTAT_HEADER) + if (format == IDLESTAT_HEADER) return ptrerror("load_and_build_cstate_info: out of memory"); else return ptrerror("build_cstate_info: out of memory"); @@ -1273,7 +1274,6 @@ int getoptions(int argc, char *argv[], struct program_options *options) options->filename = NULL; options->outfilename = NULL; options->mode = -1; - options->format = -1; options->report_ops = &default_report_ops; while (1) { @@ -124,7 +124,6 @@ enum formats { struct program_options { int mode; - int format; int display; unsigned int duration; char *filename; |