From f0f6eae05e2916a6f39de829c5913cd331cfa794 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 25 Aug 2024 16:53:46 +0530 Subject: evanix: --estimate -> --statistics --- include/evanix.h | 4 ++-- src/evanix.c | 46 +++++++++++++++++++++++----------------------- src/jobs.c | 8 ++++---- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/include/evanix.h b/include/evanix.h index 1d3d661..4522979 100644 --- a/include/evanix.h +++ b/include/evanix.h @@ -6,7 +6,7 @@ #ifndef EVANIX_H -struct estimate { +struct statistics { struct sqlite3 *db; sqlite3_stmt *statement; }; @@ -20,7 +20,7 @@ struct evanix_opts_t { bool check_cache_status; bool break_evanix; char *system; - struct estimate estimate; + struct statistics statistics; uint32_t max_builds; uint32_t max_time; int (*solver)(struct job **, struct job_clist *, int32_t); diff --git a/src/evanix.c b/src/evanix.c index da517b0..14e987d 100644 --- a/src/evanix.c +++ b/src/evanix.c @@ -26,7 +26,7 @@ static const char usage[] = " -p, --pipelined Use evanix build pipeline.\n" " -l, --check_cache-status Perform cache locality check.\n" " -c, --close-unused-fd Close stderr on exec.\n" - " -e, --estimate Path to time estimate database.\n" + " -e, --statistics Path to time statistics database.\n" " -k, --solver sjf|conformity|highs Solver to use.\n" "\n"; @@ -42,8 +42,8 @@ struct evanix_opts_t evanix_opts = { .check_cache_status = true, .solver = solver_highs, .break_evanix = false, - .estimate.db = NULL, - .estimate.statement = NULL, + .statistics.db = NULL, + .statistics.statement = NULL, }; static int evanix_build_thread_create(struct build_thread *build_thread); @@ -140,9 +140,9 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, extern char *optarg; int longindex, c; - const char *query = "SELECT duration " - "FROM estimate " - "WHERE estimate.pname = ? " + const char *query = "SELECT statistics.mean_duration " + "FROM statistics " + "WHERE statistics.pname = ? " "LIMIT 1 "; int ret = 0; @@ -156,7 +156,7 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, {"system", required_argument, NULL, 's'}, {"solver-report", no_argument, NULL, 'r'}, {"max-time", required_argument, NULL, 't'}, - {"estimate", required_argument, NULL, 'e'}, + {"statistics", required_argument, NULL, 'a'}, {"pipelined", required_argument, NULL, 'p'}, {"max-builds", required_argument, NULL, 'm'}, {"close-unused-fd", required_argument, NULL, 'c'}, @@ -164,7 +164,7 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, {NULL, 0, NULL, 0}, }; - while ((c = getopt_long(argc, argv, "hfds:r::m:p:c:l:k:e:t:", longopts, + while ((c = getopt_long(argc, argv, "hfds:r::m:p:c:l:k:a:t:", longopts, &longindex)) != -1) { switch (c) { case 'h': @@ -186,8 +186,8 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, case 'r': opts->solver_report = true; break; - case 'e': - if (opts->estimate.db) { + case 'a': + if (opts->statistics.db) { fprintf(stderr, "option -%c can't be redefined " "Try 'evanix --help' for more " @@ -196,18 +196,18 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, return -EINVAL; } - ret = sqlite3_open_v2(optarg, &opts->estimate.db, + ret = sqlite3_open_v2(optarg, &opts->statistics.db, SQLITE_OPEN_READONLY | SQLITE_OPEN_FULLMUTEX, NULL); if (ret != SQLITE_OK) { print_err("Can't open database: %s", - sqlite3_errmsg(opts->estimate.db)); + sqlite3_errmsg(opts->statistics.db)); ret = -EPERM; goto out_free_evanix; } - ret = sqlite3_prepare_v2(opts->estimate.db, query, -1, - &opts->estimate.statement, + ret = sqlite3_prepare_v2(opts->statistics.db, query, -1, + &opts->statistics.statement, NULL); if (ret != SQLITE_OK) { print_err("%s", "Failed to prepare sql"); @@ -324,8 +324,8 @@ static int opts_read(struct evanix_opts_t *opts, char **expr, int argc, "Try 'evanix --help' for more information.\n"); ret = -EINVAL; goto out_free_evanix; - } else if (opts->max_time && !opts->estimate.db) { - fprintf(stderr, "evanix: option --max-time implies --estimate\n" + } else if (opts->max_time && !opts->statistics.db) { + fprintf(stderr, "evanix: option --max-time implies --statistics\n" "Try 'evanix --help' for more information.\n"); ret = -EINVAL; goto out_free_evanix; @@ -349,20 +349,20 @@ static int evanix_free(struct evanix_opts_t *opts) { int ret; - if (opts->estimate.statement) { - sqlite3_finalize(opts->estimate.statement); - opts->estimate.statement = NULL; + if (opts->statistics.statement) { + sqlite3_finalize(opts->statistics.statement); + opts->statistics.statement = NULL; } - if (opts->estimate.db) { - ret = sqlite3_close(opts->estimate.db); + if (opts->statistics.db) { + ret = sqlite3_close(opts->statistics.db); if (ret != SQLITE_OK) { print_err("Can't open database: %s", - sqlite3_errmsg(opts->estimate.db)); + sqlite3_errmsg(opts->statistics.db)); return -EPERM; } - opts->estimate.db = NULL; + opts->statistics.db = NULL; } return 0; diff --git a/src/jobs.c b/src/jobs.c index b92a538..6e05b8f 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -170,13 +170,13 @@ int job_cost(struct job *job) return -EINVAL; } - ret = sqlite3_reset(evanix_opts.estimate.statement); + ret = sqlite3_reset(evanix_opts.statistics.statement); if (ret != SQLITE_OK) { print_err("%s", "Failed to reset sql statement"); ret = -EPERM; goto out_free_pname; } - ret = sqlite3_bind_text(evanix_opts.estimate.statement, 1, pname, -1, + ret = sqlite3_bind_text(evanix_opts.statistics.statement, 1, pname, -1, NULL); if (ret != SQLITE_OK) { print_err("%s", "Failed to bind sql"); @@ -184,7 +184,7 @@ int job_cost(struct job *job) goto out_free_pname; } - ret = sqlite3_step(evanix_opts.estimate.statement); + ret = sqlite3_step(evanix_opts.statistics.statement); if (ret == SQLITE_DONE) { print_err("Failed to acquire statistics for %s", pname); ret = -ENOENT; @@ -195,7 +195,7 @@ int job_cost(struct job *job) goto out_free_pname; } - ret = sqlite3_column_int(evanix_opts.estimate.statement, 0); + ret = sqlite3_column_int(evanix_opts.statistics.statement, 0); out_free_pname: free(pname); -- cgit v1.2.3