mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Mega-commit with features and tweaks for 1.0:
* Performance improvements * Support for splitting CPU meters into two or four columns (thanks to Wim Heirman) * Switch from PLPA, which is now deprecated, to HWLOC. * Bring back support for native Linux sched_setaffinity, so we don't have to use HWLOC where we don't need to. * Support for typing in user names and column fields in selection panels.
This commit is contained in:
12
Settings.c
12
Settings.c
@ -55,7 +55,7 @@ static void Settings_readMeterModes(Settings* this, char* line, HeaderSide side)
|
||||
String_freeArray(ids);
|
||||
}
|
||||
|
||||
static bool Settings_read(Settings* this, char* fileName) {
|
||||
static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
|
||||
// TODO: implement File object and make
|
||||
// file I/O object-oriented.
|
||||
FILE* fd;
|
||||
@ -144,7 +144,7 @@ static bool Settings_read(Settings* this, char* fileName) {
|
||||
}
|
||||
fclose(fd);
|
||||
if (!readMeters) {
|
||||
Header_defaultMeters(this->header);
|
||||
Header_defaultMeters(this->header, cpuCount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -208,7 +208,7 @@ bool Settings_write(Settings* this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Settings* Settings_new(ProcessList* pl, Header* header) {
|
||||
Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
|
||||
Settings* this = malloc(sizeof(Settings));
|
||||
this->pl = pl;
|
||||
this->header = header;
|
||||
@ -225,15 +225,15 @@ Settings* Settings_new(ProcessList* pl, Header* header) {
|
||||
this->colorScheme = 0;
|
||||
this->changed = false;
|
||||
this->delay = DEFAULT_DELAY;
|
||||
bool ok = Settings_read(this, this->userSettings);
|
||||
bool ok = Settings_read(this, this->userSettings, cpuCount);
|
||||
if (!ok) {
|
||||
this->changed = true;
|
||||
// TODO: how to get SYSCONFDIR correctly through Autoconf?
|
||||
char* systemSettings = String_cat(SYSCONFDIR, "/htoprc");
|
||||
ok = Settings_read(this, systemSettings);
|
||||
ok = Settings_read(this, systemSettings, cpuCount);
|
||||
free(systemSettings);
|
||||
if (!ok) {
|
||||
Header_defaultMeters(this->header);
|
||||
Header_defaultMeters(this->header, cpuCount);
|
||||
pl->hideKernelThreads = true;
|
||||
pl->highlightMegabytes = true;
|
||||
pl->highlightThreads = false;
|
||||
|
Reference in New Issue
Block a user