Add logs for debugging 90/272490/11
authorChanggyu Choi <changyu.choi@samsung.com>
Fri, 18 Mar 2022 00:50:48 +0000 (09:50 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Fri, 18 Mar 2022 06:28:42 +0000 (15:28 +0900)
Change-Id: Ie8e96eea8d08aa6b4024045c4c60caaa3f353093
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/launchpad-process-pool/src/launchpad.c

index b4907f0..104f426 100644 (file)
@@ -1489,7 +1489,10 @@ static bool __handle_loader_event(int fd, io_condition_e cond, void *data)
                        cpc->prepared = true;
                        cpc->send_fd = client_fd;
 
-                       SECURE_LOGD("Type %d candidate process was connected, "
+                       SECURE_LOGI("Type %d candidate process was connected, "
+                                       "pid: %d", cpc->type, cpc->pid);
+
+                       _print_hwc_log("Type %d candidate process was connected, "
                                        "pid: %d", cpc->type, cpc->pid);
                        cpc->client_channel = _io_channel_create(client_fd,
                                        IO_IN | IO_HUP,
@@ -2116,10 +2119,12 @@ static void __update_slot_state(candidate_process_context_t *cpc, int method,
        switch (method) {
        case METHOD_OUT_OF_MEMORY:
                if ((force || cpc->deactivation_method & method) &&
-                               __is_low_memory())
+                               __is_low_memory()) {
+                       _W("Low memory, deactivate slot %d", cpc->type);
                        __deactivate_slot(cpc);
-               else
+               } else {
                        __activate_slot(cpc);
+               }
                break;
        case METHOD_TTL:
                if (force || cpc->deactivation_method & method)
@@ -2767,12 +2772,37 @@ static int __verify_loader_caps(const char *loader)
        return 0;
 }
 
+static void __get_app_type_string(loader_info_t *info, char buf[], int size)
+{
+       GList *iter = info->app_types;
+       char *app_type;
+       char *ptr = buf;
+       int len;
+
+       while (iter) {
+               app_type = (char *)iter->data;
+               iter = g_list_next(iter);
+               len = strlen(app_type);
+               if (size < len + 1)
+                       return;
+
+               strncpy(ptr, app_type, size);
+               ptr += len;
+               size -= len;
+                if (iter) {
+                       (*ptr++) = ' ';
+                       size--;
+               }
+        }
+}
+
 static void __add_slot_from_info(gpointer data, gpointer user_data)
 {
        loader_info_t *info = (loader_info_t *)data;
        candidate_process_context_t *cpc;
        bundle_raw *extra = NULL;
        int len;
+       char buf[2048] = {0, };
 
        if (!strcmp(info->exe, "null")) {
                cpc = __add_slot(LAUNCHPAD_LOADER_TYPE_USER + user_slot_offset,
@@ -2821,7 +2851,12 @@ static void __add_slot_from_info(gpointer data, gpointer user_data)
 
                info->type = LAUNCHPAD_LOADER_TYPE_USER + user_slot_offset;
                user_slot_offset++;
-       }
+                __get_app_type_string(info, buf, sizeof(buf));
+                _I("candidate slot. app-type(%s) loader-type(%d)",
+                               buf, info->type);
+               _print_hwc_log("candidate slot. app-type(%s) loader-type(%d)",
+                               buf, info->type);
+        }
 }
 
 static int __add_default_slots(void)
@@ -3277,4 +3312,3 @@ int main(int argc, char **argv)
 
        return -1;
 }
-