aboutsummaryrefslogtreecommitdiff
path: root/idlestat.c
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-05 09:53:48 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-05 10:21:11 +0200
commita982ea5165736566760cc0fc3fa65b2482188fed (patch)
tree26c08995f1e7755daf0dc3b056d3fe8dfad0f3e6 /idlestat.c
parent7a706b869bff765eb3d2775d31acc6d0e7b32c91 (diff)
idlestat: Remove unused functions
The functions used to calculate core/cluster c-state statistics from individual cpu statistics are no longer used and can be removed. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
Diffstat (limited to 'idlestat.c')
-rw-r--r--idlestat.c234
1 files changed, 0 insertions, 234 deletions
diff --git a/idlestat.c b/idlestat.c
index a9dc12a..c65c33d 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -204,113 +204,6 @@ static int display_wakeup(struct report_ops *ops, void *arg, void *baseline, cha
return 0;
}
-static struct cpuidle_data *intersection(struct cpuidle_data *data1,
- struct cpuidle_data *data2)
-{
- double begin, end;
- struct cpuidle_data *data;
-
- assert(data1 != NULL);
- assert(data2 != NULL);
-
- begin = MAX(data1->begin, data2->begin);
- end = MIN(data1->end, data2->end);
-
- if (begin >= end)
- return NULL;
-
- data = calloc(sizeof(*data), 1);
- if (!data)
- return ptrerror(__func__);
-
- data->begin = begin;
- data->end = end;
- data->duration = end - begin;
- data->duration *= USEC_PER_SEC;
-
- return data;
-}
-
-static struct cpuidle_cstate *inter(struct cpuidle_cstate *c1,
- struct cpuidle_cstate *c2)
-{
- int i, j;
- struct cpuidle_data *interval;
- struct cpuidle_cstate *result;
- struct cpuidle_data *data = NULL;
- size_t index;
-
- /*
- * Watch out! These may create aliases that end up stored
- * permanently! (e.g. if nrcpus == 1)
- * TODO: This is obviously a bug.
- */
- if (!c1)
- return c2;
- if (!c2)
- return c1;
-
- result = calloc(sizeof(*result), 1);
- if (!result)
- return ptrerror(__func__);
-
- result->inter_result = 1;
-
- for (i = 0, index = 0; i < c1->nrdata; i++) {
-
- for (j = index; j < c2->nrdata; j++) {
- struct cpuidle_data *tmp;
-
- /* intervals are ordered, no need to go further */
- if (c1->data[i].end < c2->data[j].begin)
- break;
-
- /* primary loop begins where we ended */
- if (c1->data[i].begin > c2->data[j].end)
- index = j;
-
- interval = intersection(&c1->data[i], &c2->data[j]);
- if (!interval)
- continue;
- if (is_err(interval)) {
- free(data);
- free(result);
- return ptrerror(NULL);
- }
-
- result->min_time = MIN(result->min_time,
- interval->duration);
-
- result->max_time = MAX(result->max_time,
- interval->duration);
-
- result->avg_time = AVG(result->avg_time,
- interval->duration,
- result->nrdata + 1);
-
- result->duration += interval->duration;
-
- result->nrdata++;
-
- tmp = realloc(data, sizeof(*data) * result->nrdata);
- if (!tmp) {
- free(data);
- free(result);
- return ptrerror(__func__);
- }
- data = tmp;
-
- /* Newly allocated area will be 100% overwritten */
- data[result->nrdata - 1] = *interval;
-
- free(interval);
- }
- }
-
- result->data = data;
- return result;
-}
-
static char *cpuidle_cstate_name(int cpu, int state)
{
char *fpath, *name;
@@ -1025,133 +918,6 @@ struct cpuidle_datas *idlestat_load(const char *filename)
return ptrerror(NULL);
}
-struct cpuidle_cstates *core_cluster_data(struct cpu_core *s_core)
-{
- struct cpuidle_cstate *c1, *cstates, *tmp;
- struct cpuidle_cstates *result;
- struct cpu_cpu *s_cpu;
- int i;
- int cstate_max = -1;
-
- if (!s_core->is_ht)
- list_for_each_entry(s_cpu, &s_core->cpu_head, list_cpu)
- return s_cpu->cstates;
-
- result = calloc(sizeof(*result), 1);
- if (!result)
- return NULL;
-
- /* hack but negligible overhead */
- list_for_each_entry(s_cpu, &s_core->cpu_head, list_cpu)
- cstate_max = MAX(cstate_max, s_cpu->cstates->cstate_max);
- result->cstate_max = cstate_max;
-
- for (i = 0; i < cstate_max + 1; i++) {
- cstates = NULL;
- list_for_each_entry(s_cpu, &s_core->cpu_head, list_cpu) {
- c1 = &s_cpu->cstates->cstate[i];
-
- tmp = inter(cstates, c1);
- if (cstates && cstates != tmp &&
- cstates->inter_result) {
- free(cstates->data);
- free(cstates);
- }
- cstates = tmp;
-
- if (!cstates)
- continue;
- if (is_err(cstates)) {
- release_cstate_info(result, 1);
- return ptrerror(NULL);
- }
- }
- /* copy state name from first cpu */
- s_cpu = list_first_entry(&s_core->cpu_head, struct cpu_cpu,
- list_cpu);
- cstates->name = strdup(s_cpu->cstates->cstate[i].name);
-
- result->cstate[i] = *cstates;
- result->cstate[i].inter_result = 0;
-
- /*
- * Free cstates if it has been allocated by inter()
- * Do not free things pointed to by members of cstates
- * even if you free cstates itself.
- */
- if (cstates && cstates->inter_result) {
- free(cstates);
- } else {
- fprintf(stderr, "Warning: %s aliased cstates at %p\n",
- __func__, cstates);
- }
- }
-
- return result;
-}
-
-struct cpuidle_cstates *physical_cluster_data(struct cpu_physical *s_phy)
-{
- struct cpuidle_cstate *c1, *cstates, *tmp;
- struct cpuidle_cstates *result;
- struct cpu_core *s_core;
- int i;
- int cstate_max = -1;
-
- result = calloc(sizeof(*result), 1);
- if (!result)
- return NULL;
-
- /* hack but negligible overhead */
- list_for_each_entry(s_core, &s_phy->core_head, list_core)
- cstate_max = MAX(cstate_max, s_core->cstates->cstate_max);
- result->cstate_max = cstate_max;
-
- for (i = 0; i < cstate_max + 1; i++) {
- cstates = NULL;
- list_for_each_entry(s_core, &s_phy->core_head, list_core) {
- c1 = &s_core->cstates->cstate[i];
-
- tmp = inter(cstates, c1);
- if (cstates && cstates != tmp &&
- cstates->inter_result) {
- free(cstates->data);
- free(cstates);
- }
- cstates = tmp;
-
- if (!cstates)
- continue;
- if (is_err(cstates)) {
- release_cstate_info(result, 1);
- return ptrerror(NULL);
- }
- }
- /* copy state name from first core (if any) */
- s_core = list_first_entry(&s_phy->core_head, struct cpu_core,
- list_core);
- cstates->name = s_core->cstates->cstate[i].name ?
- strdup(s_core->cstates->cstate[i].name) : NULL;
-
- result->cstate[i] = *cstates;
- result->cstate[i].inter_result = 0;
-
- /*
- * Free cstates if it has been allocated by inter()
- * Do not free things pointed to by members of cstates
- * even if you free cstates itself.
- */
- if (cstates && cstates->inter_result) {
- free(cstates);
- } else {
- fprintf(stderr, "Warning: %s aliased cstates at %p\n",
- __func__, cstates);
- }
- }
-
- return result;
-}
-
static void help(const char *cmd)
{
fprintf(stderr,