From af7adc72f8017755018eea68aac520a2f53b3581 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 25 Jul 2024 08:23:20 +0530 Subject: solver_greedy/solver_report: remove redundant data --- include/jobs.h | 1 - src/jobs.c | 1 - src/solver_greedy.c | 26 ++++---------------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/include/jobs.h b/include/jobs.h index 37ba423..2610c7b 100644 --- a/include/jobs.h +++ b/include/jobs.h @@ -30,7 +30,6 @@ struct job { /* solver */ ssize_t id; bool stale; - bool reported; }; CIRCLEQ_HEAD(job_clist, job); diff --git a/src/jobs.c b/src/jobs.c index 991d21b..83a18c8 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -443,7 +443,6 @@ static int job_new(struct job **j, char *name, char *drv_path, char *attr, return -errno; } job->scheduled = false; - job->reported = false; job->id = -1; job->outputs_size = 0; diff --git a/src/solver_greedy.c b/src/solver_greedy.c index 4fcea00..09b026f 100644 --- a/src/solver_greedy.c +++ b/src/solver_greedy.c @@ -35,21 +35,6 @@ static float conformity(struct job *job) return conformity; } -static void solver_report(struct job *job, int32_t resources) -{ - if (!evanix_opts.solver_report) - return; - else if (job->reported) - return; - - job->reported = true; - printf("❌ cost: %2d > %2d <-> %s -> %s\n", job_cost_recursive(job), - resources, job->name, job->drv_path); - - for (size_t i = 0; i < job->parents_filled; i++) - solver_report(job->parents[i], resources); -} - int solver_greedy(struct job **job, struct job_clist *q, int32_t resources) { struct job *j; @@ -63,8 +48,10 @@ int solver_greedy(struct job **job, struct job_clist *q, int32_t resources) continue; } else if (job_cost_recursive(j) > resources) { job_stale_set(j); - solver_report(j, resources); - continue; + if (evanix_opts.solver_report) { + printf("❌ refusing to build %s, cost: %d\n", + j->drv_path, job_cost_recursive(j)); + } } } @@ -80,11 +67,6 @@ int solver_greedy(struct job **job, struct job_clist *q, int32_t resources) selected->deps_filled > j->deps_filled) { selected = j; } - - if (!evanix_opts.solver_report) - continue; - printf("ℹī¸ cost: %2d, conformity: %.2f -> %s\n", - job_cost_recursive(j), conformity_cur, j->drv_path); } if (selected == NULL) -- cgit v1.2.3