summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2018-07-17 16:08:32 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2018-07-17 16:42:36 +0200
commit473ed6d0f33e3e3628ec709662677107e7c7484e (patch)
tree987448c650df6ca8c37960003ff235220f3f03ee /src
parente29a8eb2fd69909281aeef2dcf6457e9b3b5fd3b (diff)
downloadttsd-worker-task-473ed6d0f33e3e3628ec709662677107e7c7484e.tar.gz
ttsd-worker-task-473ed6d0f33e3e3628ec709662677107e7c7484e.tar.bz2
ttsd-worker-task-473ed6d0f33e3e3628ec709662677107e7c7484e.zip
top generator related fixes
Change-Id: Ic4dd1274a976da898c007e8a5a0e893c17ed6a68
Diffstat (limited to 'src')
-rw-r--r--src/config-deserializer.c2
-rw-r--r--src/ipc.c3
-rw-r--r--src/proc-scanner.c2
-rw-r--r--src/report-generator.c4
-rw-r--r--src/report-json-serializer.c12
5 files changed, 12 insertions, 11 deletions
diff --git a/src/config-deserializer.c b/src/config-deserializer.c
index 0dc8290..5a733e7 100644
--- a/src/config-deserializer.c
+++ b/src/config-deserializer.c
@@ -101,7 +101,7 @@ static void config_array_iterate_func(JsonArray *array, guint index, JsonNode *e
configs[index].data.top.options = config_parse_options(target);
const gchar *subject = json_object_get_string_member(entry, SCHEMA_SUBJECT);
- configs[index].data.top.options = config_parse_top_subject(subject);
+ configs[index].data.top.subject = config_parse_top_subject(subject);
gint64 top = json_object_get_int_member(entry, SCHEMA_TOP);
configs[index].data.top.top = top;
diff --git a/src/ipc.c b/src/ipc.c
index a5b8300..2fc12bb 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -111,7 +111,6 @@ static gboolean invoke_on_main_thread_cb(gpointer user_data)
static void send_report(const char *report_data, ttd_worker_working_state_e status)
{
struct report_data *r_data = (struct report_data *)g_malloc(sizeof(struct report_data));
-
r_data->data = strdup(report_data);
r_data->status = status;
g_main_context_invoke(NULL, invoke_on_main_thread_cb, r_data);
@@ -125,4 +124,4 @@ static void submit_result_cb(ttd_worker_submit_result_e result, ttd_worker_repor
DBG("Sending result failed");
ttd_worker_report_free(report);
-} \ No newline at end of file
+}
diff --git a/src/proc-scanner.c b/src/proc-scanner.c
index 4e72753..dd5ea61 100644
--- a/src/proc-scanner.c
+++ b/src/proc-scanner.c
@@ -135,7 +135,7 @@ static struct process *_proc_scanner_find_process_in_history(proc_scanner_t *sca
static bool _proc_scanner_read_pid(int pid, void *user_data)
{
proc_scanner_t *scanner = user_data;
- struct process proc_new;
+ struct process proc_new = {0,};
struct process *proc = _proc_scanner_find_process_in_history(scanner, pid);
diff --git a/src/report-generator.c b/src/report-generator.c
index 8fbcd23..a65ab6b 100644
--- a/src/report-generator.c
+++ b/src/report-generator.c
@@ -486,7 +486,9 @@ static int _report_generator_top_report_generator_scan_apps(
app_info_iterator_free(iter);
- return proc_scanner_scan_pids(generator->scanner, pids, count);
+ int ret = proc_scanner_scan_pids(generator->scanner, pids, i);
+ free(pids);
+ return ret;
}
static int _report_generator_top_report_generator_scan_all(
diff --git a/src/report-json-serializer.c b/src/report-json-serializer.c
index 03f1949..e991081 100644
--- a/src/report-json-serializer.c
+++ b/src/report-json-serializer.c
@@ -132,7 +132,7 @@ static void top_cpu_usage_reports_to_json_object(JsonBuilder *builder, struct pr
json_builder_begin_object(builder);
json_builder_set_member_name(builder, SCHEMA_TYPE);
- json_builder_add_string_value(builder, SCHEMA_TYPE_PROCESS);
+ json_builder_add_string_value(builder, SCHEMA_TYPE_TOP);
json_builder_set_member_name(builder, SCHEMA_TARGET);
json_builder_add_string_value(builder, SCHEMA_TARGET_CPU);
@@ -148,13 +148,13 @@ static void top_cpu_usage_reports_to_json_object(JsonBuilder *builder, struct pr
json_builder_add_string_value(builder, reports[i].app_id);
json_builder_set_member_name(builder, SCHEMA_RESULT_PID);
- json_builder_add_double_value(builder, reports[i].pid);
+ json_builder_add_int_value(builder, reports[i].pid);
json_builder_set_member_name(builder, SCHEMA_RESULT_RESULT);
json_builder_begin_object(builder);
json_builder_set_member_name(builder, SCHEMA_RESULT_TIME);
- json_builder_add_double_value(builder, reports[i].time);
+ json_builder_add_int_value(builder, reports[i].time);
json_builder_set_member_name(builder, SCHEMA_RESULT_USAGE);
json_builder_add_double_value(builder, reports[i].usage);
@@ -172,7 +172,7 @@ static void top_memory_usage_reports_to_json_object(JsonBuilder *builder, struct
json_builder_begin_object(builder);
json_builder_set_member_name(builder, SCHEMA_TYPE);
- json_builder_add_string_value(builder, SCHEMA_TYPE_PROCESS);
+ json_builder_add_string_value(builder, SCHEMA_TYPE_TOP);
json_builder_set_member_name(builder, SCHEMA_TARGET);
json_builder_add_string_value(builder, SCHEMA_TARGET_MEMORY);
@@ -188,13 +188,13 @@ static void top_memory_usage_reports_to_json_object(JsonBuilder *builder, struct
json_builder_add_string_value(builder, reports[i].app_id);
json_builder_set_member_name(builder, SCHEMA_RESULT_PID);
- json_builder_add_double_value(builder, reports[i].pid);
+ json_builder_add_int_value(builder, reports[i].pid);
json_builder_set_member_name(builder, SCHEMA_RESULT_RESULT);
json_builder_begin_object(builder);
json_builder_set_member_name(builder, SCHEMA_RESULT_TIME);
- json_builder_add_double_value(builder, reports[i].time);
+ json_builder_add_int_value(builder, reports[i].time);
json_builder_set_member_name(builder, SCHEMA_RESULT_USAGE);
json_builder_add_double_value(builder, reports[i].usage);