forked from enlightenment/enlightenment
Enlightenment: Improve cpumonitor calculation
This commit is contained in:
parent
3fb8149486
commit
74e773ab61
|
@ -30,9 +30,8 @@ _cpumonitor_proc_getcores(void)
|
|||
void
|
||||
_cpumonitor_proc_getusage(Instance *inst)
|
||||
{
|
||||
long total = 0, idle = 0, use, total_change, idle_change;
|
||||
int percent = 0, i = 0, j = 0, k = 0;
|
||||
char buf[4096], *line, *tok;
|
||||
int k = 0, j = 0;
|
||||
char buf[4096];
|
||||
FILE *f;
|
||||
CPU_Core *core;
|
||||
|
||||
|
@ -43,10 +42,12 @@ _cpumonitor_proc_getusage(Instance *inst)
|
|||
{
|
||||
if (k > 0)
|
||||
{
|
||||
total = 0;
|
||||
percent = 0;
|
||||
long total = 0, idle = 0, use = 0, total_change = 0, idle_change = 0;
|
||||
int percent = 0;
|
||||
if (!strncmp(buf, "cpu", 3))
|
||||
{
|
||||
char *line, *tok;
|
||||
int i = 0;
|
||||
line = strchr(buf, ' ');
|
||||
tok = strtok(line, " ");
|
||||
while (tok)
|
||||
|
|
|
@ -23,6 +23,13 @@ _sysinfo_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
|
|||
{
|
||||
Instance *inst = data;
|
||||
|
||||
inst->o_table = elm_table_add(inst->o_main);
|
||||
elm_table_homogeneous_set(inst->o_table, EINA_TRUE);
|
||||
E_EXPAND(inst->o_table);
|
||||
evas_object_size_hint_aspect_set(inst->o_table, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
||||
elm_object_content_set(inst->o_main, inst->o_table);
|
||||
evas_object_show(inst->o_table);
|
||||
|
||||
inst->cfg->sysinfo.o_batman = sysinfo_batman_create(inst->o_table, inst);
|
||||
elm_table_pack(inst->o_table, inst->cfg->sysinfo.o_batman, 0, 0, 1, 1);
|
||||
inst->cfg->sysinfo.o_thermal = sysinfo_thermal_create(inst->o_table, inst);
|
||||
|
@ -115,13 +122,6 @@ sysinfo_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_UN
|
|||
evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
||||
evas_object_show(inst->o_main);
|
||||
|
||||
inst->o_table = elm_table_add(inst->o_main);
|
||||
elm_table_homogeneous_set(inst->o_table, EINA_TRUE);
|
||||
E_EXPAND(inst->o_table);
|
||||
evas_object_size_hint_aspect_set(inst->o_table, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
|
||||
elm_object_content_set(inst->o_main, inst->o_table);
|
||||
evas_object_show(inst->o_table);
|
||||
|
||||
evas_object_smart_callback_add(parent, "gadget_created", _sysinfo_created_cb, inst);
|
||||
evas_object_smart_callback_add(parent, "gadget_removed", _sysinfo_removed_cb, inst);
|
||||
|
||||
|
|
Loading…
Reference in New Issue