From b09eb7e35ad03184b531b2f2d5e67abe7bd52107 Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Fri, 25 Oct 2013 15:37:52 +0400 Subject: [PATCH] [PROTO] always send MSG_SYSTEM_INFO even if all the features it contains are disabled. Change-Id: I30e8bddad0374b9d0328d031a9aeba6259d38474 Signed-off-by: Nikita Kalyazin --- daemon/da_protocol.h | 8 -------- daemon/threads.c | 44 +++++++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/daemon/da_protocol.h b/daemon/da_protocol.h index 18cfb80..4860932 100644 --- a/daemon/da_protocol.h +++ b/daemon/da_protocol.h @@ -141,14 +141,6 @@ enum feature_code{ #define IS_OPT_SET_IN(OPT, reg) (reg & (OPT)) #define IS_OPT_SET(OPT) IS_OPT_SET_IN((OPT), prof_session.conf.use_features0) -#define IS_SYSTEM_INFO_NEEDED() ( \ - IS_OPT_SET(FL_CPU) || \ - IS_OPT_SET(FL_PROCESSES) || \ - IS_OPT_SET(FL_MEMORY) || \ - IS_OPT_SET(FL_DISK) || \ - IS_OPT_SET(FL_NETWORK) || \ - IS_OPT_SET(FL_DEVICE) || \ - IS_OPT_SET(FL_ENERGY)) enum app_type { AT_TIZEN =0x01, diff --git a/daemon/threads.c b/daemon/threads.c index 642a241..15ca964 100644 --- a/daemon/threads.c +++ b/daemon/threads.c @@ -241,34 +241,32 @@ void* samplingThread(void* data) struct system_info_t sys_info; struct msg_data_t *msg; - if (IS_SYSTEM_INFO_NEEDED()) { - for (i = 0; i < MAX_TARGET_COUNT; i++) { - if (manager.target[i].socket != -1 && - manager.target[i].pid != -1) - pidarr[pidcount++] = manager.target[i].pid; - } + for (i = 0; i < MAX_TARGET_COUNT; i++) { + if (manager.target[i].socket != -1 && + manager.target[i].pid != -1) + pidarr[pidcount++] = manager.target[i].pid; + } - if (get_system_info(&sys_info, pidarr, pidcount) == -1) { - LOGE("Cannot get system info\n"); - //do not send sys_info because - //it is corrupted - continue; - } + if (get_system_info(&sys_info, pidarr, pidcount) == -1) { + LOGE("Cannot get system info\n"); + //do not send sys_info because + //it is corrupted + continue; + } - msg = pack_system_info(&sys_info); - if (!msg) { - LOGE("Cannot pack system info\n"); - reset_system_info(&sys_info); - continue; - } + msg = pack_system_info(&sys_info); + if (!msg) { + LOGE("Cannot pack system info\n"); + reset_system_info(&sys_info); + continue; + } - write_to_buf(msg); + write_to_buf(msg); - printBuf((char *)msg, MSG_DATA_HDR_LEN + msg->len); + printBuf((char *)msg, MSG_DATA_HDR_LEN + msg->len); - free_msg_data(msg); - reset_system_info(&sys_info); - } + free_msg_data(msg); + reset_system_info(&sys_info); flush_buf(); } else if(signo == SIGUSR1) -- 2.7.4