Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to hide or show Cache and Buffers in Graph mode #1540

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DisplayOptionsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
&(settings->showCPUTemperature)));
Panel_add(super, (Object*) CheckItem_newByRef("- Show temperature in degree Fahrenheit instead of Celsius", &(settings->degreeFahrenheit)));
#endif
Panel_add(super, (Object *)CheckItem_newByRef("Show cached memory in graph", &(settings->showCachedMemory)));
batk0 marked this conversation as resolved.
Show resolved Hide resolved
#ifdef HAVE_GETMOUSE
Panel_add(super, (Object*) CheckItem_newByRef("Enable the mouse", &(settings->enableMouse)));
#endif
Expand Down
10 changes: 8 additions & 2 deletions MemoryMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ static void MemoryMeter_updateValues(Meter* this) {
size_t size = sizeof(this->txtBuffer);
int written;

Settings *settings = this->host->settings;
batk0 marked this conversation as resolved.
Show resolved Hide resolved

/* shared, compressed and available memory are not supported on all platforms */
this->values[MEMORY_METER_SHARED] = NAN;
this->values[MEMORY_METER_COMPRESSED] = NAN;
this->values[MEMORY_METER_AVAILABLE] = NAN;
Platform_setMemoryValues(this);

if (this->mode == GRAPH_METERMODE && !settings->showCachedMemory)
{
batk0 marked this conversation as resolved.
Show resolved Hide resolved
this->values[MEMORY_METER_BUFFERS] = NAN;
this->values[MEMORY_METER_CACHE] = NAN;
}
/* Do not print available memory in bar mode */
static_assert(MEMORY_METER_AVAILABLE + 1 == MEMORY_METER_ITEMCOUNT,
"MEMORY_METER_AVAILABLE is not the last item in MemoryMeterValues");
"MEMORY_METER_AVAILABLE is not the last item in MemoryMeterValues");
this->curItems = MEMORY_METER_AVAILABLE;
batk0 marked this conversation as resolved.
Show resolved Hide resolved

/* we actually want to show "used + shared + compressed" */
Expand Down
3 changes: 3 additions & 0 deletions Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ static bool Settings_read(Settings* this, const char* fileName, const Machine* h
this->showCPUUsage = atoi(option[1]);
} else if (String_eq(option[0], "show_cpu_frequency")) {
this->showCPUFrequency = atoi(option[1]);
} else if (String_eq(option[0], "show_cached_memory")) {
this->showCachedMemory = atoi(option[1]);
#ifdef BUILD_WITH_CPU_TEMP
} else if (String_eq(option[0], "show_cpu_temperature")) {
this->showCPUTemperature = atoi(option[1]);
Expand Down Expand Up @@ -801,6 +803,7 @@ Settings* Settings_new(const Machine* host, Hashtable* dynamicMeters, Hashtable*
this->showCPUTemperature = false;
this->degreeFahrenheit = false;
#endif
this->showCachedMemory = true;
this->updateProcessNames = false;
this->showProgramPath = true;
this->highlightThreads = true;
Expand Down
1 change: 1 addition & 0 deletions Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct Settings_ {
bool accountGuestInCPUMeter;
bool headerMargin;
bool screenTabs;
bool showCachedMemory;
#ifdef HAVE_GETMOUSE
bool enableMouse;
#endif
Expand Down