summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-24 22:26:12 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-24 22:26:12 +0530
commita6a2e54df6cc1f716ac32f0435fcaa1f1424521e (patch)
treea11c01f142ac5b81f3768f51209b68c2e38686fd
parentb9846396dee20efe322d64971ee6d6fe2bc8829b (diff)
jobs: job_cost -> job_cost_recursive
-rw-r--r--include/jobs.h2
-rw-r--r--src/jobs.c2
-rw-r--r--src/solver_greedy.c12
3 files changed, 8 insertions, 8 deletions
diff --git a/include/jobs.h b/include/jobs.h
index cbcce74..37ba423 100644
--- a/include/jobs.h
+++ b/include/jobs.h
@@ -47,7 +47,7 @@ int job_read(FILE *stream, struct job **jobs);
/* Spawns nix-eval-jobs and connects its stdout to stream */
int jobs_init(FILE **stream, char *expr);
void job_free(struct job *j);
-int job_cost(struct job *job);
+int job_cost_recursive(struct job *job);
int job_parents_list_insert(struct job *job, struct job *parent);
void job_deps_list_rm(struct job *job, struct job *dep);
void job_stale_set(struct job *job);
diff --git a/src/jobs.c b/src/jobs.c
index 909ef1b..991d21b 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -123,7 +123,7 @@ int job_parents_list_insert(struct job *job, struct job *parent)
return 0;
}
-int job_cost(struct job *job)
+int job_cost_recursive(struct job *job)
{
int32_t builds = 1;
diff --git a/src/solver_greedy.c b/src/solver_greedy.c
index 160a035..4fcea00 100644
--- a/src/solver_greedy.c
+++ b/src/solver_greedy.c
@@ -43,8 +43,8 @@ static void solver_report(struct job *job, int32_t resources)
return;
job->reported = true;
- printf("❌ cost: %2d > %2d <-> %s -> %s\n", job_cost(job), resources,
- job->name, job->drv_path);
+ 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);
@@ -61,7 +61,7 @@ int solver_greedy(struct job **job, struct job_clist *q, int32_t resources)
CIRCLEQ_FOREACH (j, q, clist) {
if (j->stale) {
continue;
- } else if (job_cost(j) > resources) {
+ } else if (job_cost_recursive(j) > resources) {
job_stale_set(j);
solver_report(j, resources);
continue;
@@ -83,13 +83,13 @@ int solver_greedy(struct job **job, struct job_clist *q, int32_t resources)
if (!evanix_opts.solver_report)
continue;
- printf("ℹ️ cost: %2d, conformity: %.2f -> %s\n", job_cost(j),
- conformity_cur, j->drv_path);
+ printf("ℹ️ cost: %2d, conformity: %.2f -> %s\n",
+ job_cost_recursive(j), conformity_cur, j->drv_path);
}
if (selected == NULL)
return -ESRCH;
*job = selected;
- return job_cost(selected);
+ return job_cost_recursive(selected);
}