This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository enlightenment.
View the commit online.
commit ee3403baaf1f7f16cf3abe8a406ee2a0a5a2f48c
Author: Carsten Haitzler <ras...@rasterman.com>
AuthorDate: Wed Dec 4 12:59:19 2024 +0000
cpufreq - display text for cpu usage and freq in gadget
---
src/modules/cpufreq/e_mod_main.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c
index 6d513c3fb..d387ce134 100644
--- a/src/modules/cpufreq/e_mod_main.c
+++ b/src/modules/cpufreq/e_mod_main.c
@@ -48,8 +48,9 @@ _cb_cpf_render(void *data)
{
const Cpf_Stats *stats = cpf_perf_stats_get();
Instance *inst = data;
- int i, h, sc;
+ int i, h, sc, v;
void *pix;
+ char buf[128];
if (!stats) return;
for (i = 0; i < stats->rend_num; i++)
@@ -107,6 +108,21 @@ _cb_cpf_render(void *data)
}
}
}
+ if (stats->core_num > 0)
+ {
+ v = 0;
+ for (i = 0; i < stats->core_num; i++) v += stats->core_perf[i].usage;
+ v = (v + ((10 * stats->core_num) / 2)) / (stats->core_num * 10); // 0->100 avg
+ snprintf(buf, sizeof(buf), "%i%%", v);
+ edje_object_part_text_set(inst->o_cpu, "e.text.cpu.usage", buf);
+
+ v = 0;
+ for (i = 0; i < stats->core_num; i++) v += stats->core_perf[i].freq;
+ v = (v + (stats->core_num / 2)) / stats->core_num; // mhz avg
+ if (v < 1000) snprintf(buf, sizeof(buf), "%i", v); // mhz
+ else snprintf(buf, sizeof(buf), "%1.1f", (double)v / 1000.0); // ghz
+ edje_object_part_text_set(inst->o_cpu, "e.text.cpu.freq", buf);
+ }
}
static void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.