diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-06 12:41:36 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-06 12:41:36 -0300 |
commit | 6fe06fb7e55831ab81594bbac35c200136746830 (patch) | |
tree | dd4f71a2b02da7c92c1bd195566c2d0d71dc2095 /Settings.c | |
parent | 657836a2ae4c250416a258534b3f383d57f61d4c (diff) |
Portability: make list of default screens per-platform
Diffstat (limited to 'Settings.c')
-rw-r--r-- | Settings.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -24,6 +24,12 @@ in the source distribution for its full text. #include <stdbool.h> typedef struct { + const char* name; + const char* columns; + const char* sortKey; +} ScreenDefaults; + +typedef struct { int len; char** names; int* modes; @@ -266,14 +272,11 @@ ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* } static void Settings_defaultScreens(Settings* this) { - Settings_newScreen(this, "Default", "PID USER PRIORITY NICE M_SIZE M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command"); - this->screens[0]->sortKey = toFieldIndex("PERCENT_CPU"); - Settings_newScreen(this, "I/O", "PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command"); - this->screens[1]->sortKey = toFieldIndex("IO_RATE"); - Settings_newScreen(this, "Perf Counters", "PID USER PERCENT_CPU PROCESSOR MCYCLE MINSTR IPC PERCENT_MISS PERCENT_BMISS Command"); - this->screens[2]->sortKey = toFieldIndex("MCYCLE"); - Settings_newScreen(this, "L1 Data Cache", "PID USER PERCENT_CPU L1DREADS L1DRMISSES L1DWRITES L1DWMISSES Command"); - this->screens[3]->sortKey = toFieldIndex("L1DREADS"); + for (unsigned int i = 0; i < Platform_numberOfDefaultScreens; i++) { + ScreenDefaults* defaults = &Platform_defaultScreens[i]; + Settings_newScreen(this, defaults->name, defaults->columns); + this->screens[0]->sortKey = toFieldIndex(defaults->sortKey); + } } static bool Settings_read(Settings* this, const char* fileName) { |