Adding head node for proper Plugin Parsing 52/216952/1 accepted/tizen/unified/20191121.073341 submit/tizen/20191120.045455
authorDewal Agarwal <d1.agarwal@samsung.com>
Tue, 5 Nov 2019 05:33:30 +0000 (11:03 +0530)
committerDewal Agarwal <d1.agarwal@samsung.com>
Tue, 5 Nov 2019 05:33:30 +0000 (11:03 +0530)
Change-Id: Id3178c17d3dba65d12b9b4cb5fb3ddadc2f91cf6
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
plugin/cpu/src/bm_cpu_plugin.c

index c950308..773c6f3 100644 (file)
@@ -138,6 +138,7 @@ int get_feature_data(bm_data_h *handle, bm_plugin_data_type_e type)
 
        int ret;
 
+       bm_cpu_st *usage_head = NULL;
        bm_cpu_st *usage = NULL;
 
        struct timeval tv;
@@ -220,6 +221,15 @@ int get_feature_data(bm_data_h *handle, bm_plugin_data_type_e type)
                return BM_PLUGIN_ERROR_NO_DATA;
        }
 
+       /* Make usage_head data structure */
+       usage_head = (bm_cpu_st *)calloc(1, sizeof(bm_cpu_st));
+       if (!usage_head) {
+               _E("calloc failed");
+
+               EXIT;
+               return BM_PLUGIN_ERROR_OUT_OF_MEMORY;
+       }
+
        /* Make usage data structure */
        usage = (bm_cpu_st *)calloc(1, sizeof(bm_cpu_st));
        if (!usage) {
@@ -394,7 +404,8 @@ int get_feature_data(bm_data_h *handle, bm_plugin_data_type_e type)
        last_requested_time.tv_usec = tv.tv_usec;
 
        /* Return result */
-       *handle = usage;
+       usage_head->cpu_data_list = g_slist_append(usage_head->cpu_data_list, usage);
+       *handle = usage_head;
 
        _I("Succeed to get CPU usage");
        ret = BM_PLUGIN_ERROR_NONE;