forked from enlightenment/enlightenment
parent
d1cb369623
commit
921af28813
|
@ -6,8 +6,8 @@ struct _Thread_Config
|
||||||
{
|
{
|
||||||
int interval;
|
int interval;
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
int memstatus;
|
int mem_percent;
|
||||||
int swapstatus;
|
int swp_percent;
|
||||||
|
|
||||||
unsigned long mem_total;
|
unsigned long mem_total;
|
||||||
unsigned long mem_active;
|
unsigned long mem_active;
|
||||||
|
@ -35,8 +35,8 @@ _memusage_face_update(Instance *inst, int mem, int swap)
|
||||||
{
|
{
|
||||||
char text[4096];
|
char text[4096];
|
||||||
snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
|
snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
|
||||||
_("Total Memory Usage"), inst->cfg->memusage.real,
|
_("Total Memory Usage"), inst->cfg->memusage.mem_percent,
|
||||||
_("Total Swap Usage"), inst->cfg->memusage.swap);
|
_("Total Swap Usage"), inst->cfg->memusage.swp_percent);
|
||||||
elm_object_text_set(inst->cfg->memusage.popup_label, text);
|
elm_object_text_set(inst->cfg->memusage.popup_label, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,8 @@ _memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
|
||||||
_memusage_popup_deleted, inst);
|
_memusage_popup_deleted, inst);
|
||||||
|
|
||||||
snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
|
snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
|
||||||
_("Total Memory Usage"), inst->cfg->memusage.real,
|
_("Total Memory Usage"), inst->cfg->memusage.mem_percent,
|
||||||
_("Total Swap Usage"), inst->cfg->memusage.swap);
|
_("Total Swap Usage"), inst->cfg->memusage.swp_percent);
|
||||||
label = elm_label_add(popup);
|
label = elm_label_add(popup);
|
||||||
elm_object_style_set(label, "marker");
|
elm_object_style_set(label, "marker");
|
||||||
elm_object_text_set(label, text);
|
elm_object_text_set(label, text);
|
||||||
|
@ -149,9 +149,9 @@ _memusage_cb_usage_check_main(void *data, Ecore_Thread *th)
|
||||||
&thc->mem_cached, &thc->mem_buffers,
|
&thc->mem_cached, &thc->mem_buffers,
|
||||||
&thc->swp_total, &thc->swp_active);
|
&thc->swp_total, &thc->swp_active);
|
||||||
if (thc->mem_total > 0)
|
if (thc->mem_total > 0)
|
||||||
thc->memstatus = 100 * ((float)thc->mem_active / (float)thc->mem_total);
|
thc->mem_percent = 100 * ((float)thc->mem_active / (float)thc->mem_total);
|
||||||
if (thc->swp_total > 0)
|
if (thc->swp_total > 0)
|
||||||
thc->swapstatus = 100 * ((float)thc->swp_active / (float)thc->swp_total);
|
thc->swp_percent = 100 * ((float)thc->swp_active / (float)thc->swp_total);
|
||||||
|
|
||||||
ecore_thread_feedback(th, NULL);
|
ecore_thread_feedback(th, NULL);
|
||||||
if (ecore_thread_check(th)) break;
|
if (ecore_thread_check(th)) break;
|
||||||
|
@ -172,9 +172,9 @@ _memusage_cb_usage_check_notify(void *data,
|
||||||
if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE &&
|
if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE &&
|
||||||
inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
|
inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
|
||||||
|
|
||||||
inst->cfg->memusage.real = thc->memstatus;
|
inst->cfg->memusage.mem_percent = thc->mem_percent;
|
||||||
inst->cfg->memusage.swap = thc->swapstatus;
|
inst->cfg->memusage.swp_percent = thc->swp_percent;
|
||||||
_memusage_face_update(inst, thc->memstatus, thc->swapstatus);
|
_memusage_face_update(inst, thc->mem_percent, thc->swp_percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -192,8 +192,8 @@ _memusage_config_updated(Instance *inst)
|
||||||
{
|
{
|
||||||
thc->inst = inst;
|
thc->inst = inst;
|
||||||
thc->interval = inst->cfg->memusage.poll_interval;
|
thc->interval = inst->cfg->memusage.poll_interval;
|
||||||
thc->memstatus = 0;
|
thc->mem_percent = 0;
|
||||||
thc->swapstatus = 0;
|
thc->swp_percent = 0;
|
||||||
inst->cfg->memusage.usage_check_thread =
|
inst->cfg->memusage.usage_check_thread =
|
||||||
ecore_thread_feedback_run(_memusage_cb_usage_check_main,
|
ecore_thread_feedback_run(_memusage_cb_usage_check_main,
|
||||||
_memusage_cb_usage_check_notify,
|
_memusage_cb_usage_check_notify,
|
||||||
|
@ -316,8 +316,8 @@ _conf_item_get(int *id)
|
||||||
|
|
||||||
ci->esm = E_SYSINFO_MODULE_MEMUSAGE;
|
ci->esm = E_SYSINFO_MODULE_MEMUSAGE;
|
||||||
ci->memusage.poll_interval = 32;
|
ci->memusage.poll_interval = 32;
|
||||||
ci->memusage.real = 0;
|
ci->memusage.mem_percent = 0;
|
||||||
ci->memusage.swap = 0;
|
ci->memusage.swp_percent = 0;
|
||||||
ci->memusage.popup = NULL;
|
ci->memusage.popup = NULL;
|
||||||
ci->memusage.configure = NULL;
|
ci->memusage.configure = NULL;
|
||||||
|
|
||||||
|
@ -334,8 +334,8 @@ memusage_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_U
|
||||||
inst = E_NEW(Instance, 1);
|
inst = E_NEW(Instance, 1);
|
||||||
inst->cfg = _conf_item_get(id);
|
inst->cfg = _conf_item_get(id);
|
||||||
*id = inst->cfg->id;
|
*id = inst->cfg->id;
|
||||||
inst->cfg->memusage.real = 0;
|
inst->cfg->memusage.mem_percent = 0;
|
||||||
inst->cfg->memusage.swap = 0;
|
inst->cfg->memusage.swp_percent = 0;
|
||||||
inst->cfg->memusage.popup = NULL;
|
inst->cfg->memusage.popup = NULL;
|
||||||
inst->cfg->memusage.configure = NULL;
|
inst->cfg->memusage.configure = NULL;
|
||||||
inst->o_main = elm_box_add(parent);
|
inst->o_main = elm_box_add(parent);
|
||||||
|
|
|
@ -107,8 +107,8 @@ sysinfo_init(void)
|
||||||
ci->cpumonitor.popup = NULL;
|
ci->cpumonitor.popup = NULL;
|
||||||
ci->cpumonitor.configure = NULL;
|
ci->cpumonitor.configure = NULL;
|
||||||
ci->memusage.poll_interval = 32;
|
ci->memusage.poll_interval = 32;
|
||||||
ci->memusage.real = 0;
|
ci->memusage.mem_percent = 0;
|
||||||
ci->memusage.swap = 0;
|
ci->memusage.swp_percent = 0;
|
||||||
ci->memusage.popup = NULL;
|
ci->memusage.popup = NULL;
|
||||||
ci->memusage.configure = NULL;
|
ci->memusage.configure = NULL;
|
||||||
ci->netstatus.poll_interval = 32;
|
ci->netstatus.poll_interval = 32;
|
||||||
|
|
|
@ -117,8 +117,8 @@ _conf_item_get(int *id)
|
||||||
ci->cpumonitor.popup = NULL;
|
ci->cpumonitor.popup = NULL;
|
||||||
ci->cpumonitor.configure = NULL;
|
ci->cpumonitor.configure = NULL;
|
||||||
ci->memusage.poll_interval = 32;
|
ci->memusage.poll_interval = 32;
|
||||||
ci->memusage.real = 0;
|
ci->memusage.mem_percent = 0;
|
||||||
ci->memusage.swap = 0;
|
ci->memusage.swp_percent = 0;
|
||||||
ci->memusage.popup = NULL;
|
ci->memusage.popup = NULL;
|
||||||
ci->memusage.configure = NULL;
|
ci->memusage.configure = NULL;
|
||||||
ci->netstatus.poll_interval = 32;
|
ci->netstatus.poll_interval = 32;
|
||||||
|
|
|
@ -206,8 +206,8 @@ struct _Config_Item
|
||||||
Evas_Object *popup_label;
|
Evas_Object *popup_label;
|
||||||
Evas_Object *configure;
|
Evas_Object *configure;
|
||||||
int poll_interval;
|
int poll_interval;
|
||||||
int real;
|
int mem_percent;
|
||||||
int swap;
|
int swp_percent;
|
||||||
Ecore_Thread *usage_check_thread;
|
Ecore_Thread *usage_check_thread;
|
||||||
} memusage;
|
} memusage;
|
||||||
struct
|
struct
|
||||||
|
|
Loading…
Reference in New Issue