summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorZev Weiss <zev@bewilderbeest.net>2019-12-19 16:30:45 -0600
committerZev Weiss <zev@bewilderbeest.net>2020-09-15 03:25:08 -0500
commit2899ed4cb00f4d887ee92c91e274ef098fd14f2b (patch)
treef03e627afc21aeacaf294eaac0e7d005fcd98eaf /Settings.c
parenta2fef38be74d4022ef4510e749e4b136d4ac2c33 (diff)
Number CPUs from zero by default.
Numbering from one is idiosyncratic and inconsistent with basically everything else in the world; it doesn't make much sense as default behavior. All naming is updated to reflect that numbering from one is a non-default, opt-in option. The old label of the flag saved in htoprc ("cpu_count_from_zero") is still supported for backwards compatibility with existing configs, however.
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Settings.c b/Settings.c
index d6ef53b9..3330d062 100644
--- a/Settings.c
+++ b/Settings.c
@@ -166,8 +166,11 @@ static bool Settings_read(Settings* this, const char* fileName) {
this->detailedCPUTime = atoi(option[1]);
} else if (String_eq(option[0], "detailed_cpu_time")) {
this->detailedCPUTime = atoi(option[1]);
+ } else if (String_eq(option[0], "cpu_count_from_one")) {
+ this->countCPUsFromOne = atoi(option[1]);
} else if (String_eq(option[0], "cpu_count_from_zero")) {
- this->countCPUsFromZero = atoi(option[1]);
+ // old (inverted) naming also supported for backwards compatibility
+ this->countCPUsFromOne = !atoi(option[1]);
} else if (String_eq(option[0], "show_cpu_usage")) {
this->showCPUUsage = atoi(option[1]);
} else if (String_eq(option[0], "show_cpu_frequency")) {
@@ -266,7 +269,7 @@ bool Settings_write(Settings* this) {
fprintf(fd, "tree_view=%d\n", (int) this->treeView);
fprintf(fd, "header_margin=%d\n", (int) this->headerMargin);
fprintf(fd, "detailed_cpu_time=%d\n", (int) this->detailedCPUTime);
- fprintf(fd, "cpu_count_from_zero=%d\n", (int) this->countCPUsFromZero);
+ fprintf(fd, "cpu_count_from_one=%d\n", (int) this->countCPUsFromOne);
fprintf(fd, "show_cpu_usage=%d\n", (int) this->showCPUUsage);
fprintf(fd, "show_cpu_frequency=%d\n", (int) this->showCPUFrequency);
fprintf(fd, "update_process_names=%d\n", (int) this->updateProcessNames);
@@ -299,7 +302,7 @@ Settings* Settings_new(int cpuCount) {
this->highlightBaseName = false;
this->highlightMegabytes = false;
this->detailedCPUTime = false;
- this->countCPUsFromZero = false;
+ this->countCPUsFromOne = false;
this->showCPUUsage = true;
this->showCPUFrequency = false;
this->updateProcessNames = false;

© 2014-2024 Faster IT GmbH | imprint | privacy policy