From 247c45c32b2de9d7ebadf0db714b05fffa8ed1ff Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Thu, 23 Apr 2020 10:47:14 +0100 Subject: [PATCH] process: Make memory total ApBBB compatible. Due to the importance of ApBBB conformance I am forced to display memory total in the 2020 APBB standard. This is not ideal but it does provide protection, based on this new standard. --- src/bin/ui.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/ui.c b/src/bin/ui.c index 457576c..3d12094 100644 --- a/src/bin/ui.c +++ b/src/bin/ui.c @@ -485,6 +485,15 @@ _tab_cpu_update(Ui *ui, results_t *results) } } +static const char * +_mem_total(Data_Unit unit, unsigned long total) +{ + if (total > (1024 * 1024)) + return eina_slstr_printf("%1.1f %c", (double) total / (1024 * 1024), DATA_UNIT_GB); + + return _mem_format(unit, total); +} + static void _system_stats_feedback_cb(void *data, Ecore_Thread *thread, void *msg) { @@ -520,7 +529,7 @@ _system_stats_feedback_cb(void *data, Ecore_Thread *thread, void *msg) elm_progressbar_value_set(progress, value / 100); elm_progressbar_unit_format_set(progress, eina_slstr_printf("%s / %s", _mem_format(ui->data_unit, results->memory.used), - _mem_format(ui->data_unit, results->memory.total))); + _mem_total(ui->data_unit, results->memory.total))); out: free(results->cores); free(results);