davemds pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=4c2116ac0ffcda1e06a3de0767bd00087ccaa6f2

commit 4c2116ac0ffcda1e06a3de0767bd00087ccaa6f2
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sun Jan 8 19:05:33 2017 +0100

    mem gadget: no need to send 2 consecutive int_set msgs
    
    One msg with 2 ints is more efficient
---
 src/modules/sysinfo/memusage/memusage.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/modules/sysinfo/memusage/memusage.c 
b/src/modules/sysinfo/memusage/memusage.c
index a1cbd67..a3b29f8 100644
--- a/src/modules/sysinfo/memusage/memusage.c
+++ b/src/modules/sysinfo/memusage/memusage.c
@@ -11,20 +11,17 @@ struct _Thread_Config
 };
 
 static void
-_memusage_face_update(Instance *inst, Eina_Bool swap, int status)
+_memusage_face_update(Instance *inst, int mem, int swap)
 {
-   Edje_Message_Int_Set *usage_msg;
-
-   usage_msg = malloc(sizeof(Edje_Message_Int_Set) + 1 * sizeof(int));
-   EINA_SAFETY_ON_NULL_RETURN(usage_msg);
-   usage_msg->count = 1;
-   usage_msg->val[0] = status;
-   if (!swap)
-     
edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget), 
EDJE_MESSAGE_INT_SET, 1,
-                              usage_msg);
-   else
-     
edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget), 
EDJE_MESSAGE_INT_SET, 2,
-                              usage_msg);
+   Edje_Message_Int_Set *msg;
+
+   msg = malloc(sizeof(Edje_Message_Int_Set) + 2 * sizeof(int));
+   EINA_SAFETY_ON_NULL_RETURN(msg);
+   msg->count = 2;
+   msg->val[0] = mem;
+   msg->val[1] = swap;
+   edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget),
+                            EDJE_MESSAGE_INT_SET, 1, msg);
 }
 
 static void
@@ -53,8 +50,7 @@ _memusage_cb_usage_check_notify(void *data,
 
    if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && inst->cfg->esm != 
E_SYSINFO_MODULE_SYSINFO) return;
    if (!inst->cfg) return;
-   _memusage_face_update(inst, EINA_FALSE, thc->memstatus);
-   _memusage_face_update(inst, EINA_TRUE, thc->swapstatus);
+   _memusage_face_update(inst, thc->memstatus, thc->swapstatus);
 }
 
 void

-- 


Reply via email to