[PROTO] system info: send load for all processes
[platform/core/system/swap-manager.git] / daemon / threads.c
index 0b1cad5..8fc2b73 100644 (file)
@@ -246,16 +246,13 @@ void* samplingThread(void* data)
                }
 
                if (signo == SIGALRM) {
-                       int pidarr[MAX_TARGET_COUNT];
+                       const int max_pid_num = 1024; /* ugly hardcode */
+                       int pidarr[max_pid_num];
                        int pidcount = 0;
                        struct system_info_t sys_info;
                        struct msg_data_t *msg;
 
-                       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;
-                       }
+                       pidcount = get_pid_array(pidarr, max_pid_num);
 
                        if (get_system_info(&sys_info, pidarr, pidcount) == -1) {
                                LOGE("Cannot get system info\n");