diff options
author | Michal Kolodziejski <m.kolodziejs@samsung.com> | 2018-07-16 16:44:55 +0200 |
---|---|---|
committer | Michal Kolodziejski <m.kolodziejs@samsung.com> | 2018-07-16 17:27:22 +0200 |
commit | 3a2acc0e6cc0f468c8348b6af970a1b7d1651991 (patch) | |
tree | dcc3554c5ffa33e5d7f8f19727f09addf0d0fe69 /src | |
parent | 09e11a61662ae3179af02ffbc571da8c16fea46b (diff) | |
download | ttsd-worker-task-3a2acc0e6cc0f468c8348b6af970a1b7d1651991.tar.gz ttsd-worker-task-3a2acc0e6cc0f468c8348b6af970a1b7d1651991.tar.bz2 ttsd-worker-task-3a2acc0e6cc0f468c8348b6af970a1b7d1651991.zip |
refactor: merged process cpu and mem reports into one struct
Change-Id: I66b3c8b9c1b9461abc16e617968effabf5946de5
Signed-off-by: Michal Kolodziejski <m.kolodziejs@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/report-generator.c | 4 | ||||
-rw-r--r-- | src/report-generator.h | 10 | ||||
-rw-r--r-- | src/report-json-serializer.h | 8 | ||||
-rw-r--r-- | src/report.h | 17 |
4 files changed, 15 insertions, 24 deletions
diff --git a/src/report-generator.c b/src/report-generator.c index e442523..22e7e29 100644 --- a/src/report-generator.c +++ b/src/report-generator.c @@ -206,7 +206,7 @@ int report_generator_generate_system_memory_usage_report( int report_generator_generate_process_cpu_usage_report( report_generator_process_t *generator, int interval, - struct process_cpu_usage_report *report) + struct process_usage_report *report) { ON_NULL_RETURN_VAL(generator, -1); ON_TRUE_RETURN_VAL(interval < 0, -1); @@ -245,7 +245,7 @@ int report_generator_generate_process_cpu_usage_report( int report_generator_generate_process_memory_usage_report( report_generator_process_t *generator, - struct process_memory_usage_report *report) + struct process_usage_report *report) { ON_NULL_RETURN_VAL(generator, -1); ON_NULL_RETURN_VAL(report, -1); diff --git a/src/report-generator.h b/src/report-generator.h index d50dc2d..20fef53 100644 --- a/src/report-generator.h +++ b/src/report-generator.h @@ -137,7 +137,7 @@ int report_generator_generate_system_memory_usage_report( struct system_usage_report *report); /** - * @brief Fills process_cpu_usage_report. + * @brief Fills process_usage_report. * * When interval > 0 the function will block for interval seconds and return report with * process cpu usage calculated as average during interval period. @@ -153,10 +153,10 @@ int report_generator_generate_system_memory_usage_report( int report_generator_generate_process_cpu_usage_report( report_generator_process_t *generator, int interval, - struct process_cpu_usage_report *report); + struct process_usage_report *report); /** - * @brief Fills process_memory_usage_report. + * @brief Fills process_usage_report. * * @param[in] generator process generator * @param[out] report @@ -164,7 +164,7 @@ int report_generator_generate_process_cpu_usage_report( */ int report_generator_generate_proccess_memory_usage_report( report_generator_process_t *generator, - struct process_memory_usage_report *report); + struct process_usage_report *report); /** * @brief Fills apps_cpu_usage_report. @@ -187,7 +187,7 @@ int report_generator_generate_app_cpu_usage_report( struct app_cpu_usage_report *report); /** - * @brief Fills process_memory_usage_report. + * @brief Fills process_usage_report. * * @param[in] generator apps generator * @param[out] report diff --git a/src/report-json-serializer.h b/src/report-json-serializer.h index 73a236c..0b77a7c 100644 --- a/src/report-json-serializer.h +++ b/src/report-json-serializer.h @@ -50,24 +50,24 @@ char *report_json_serializer_serialize_system_memory_usage_report(struct system_ char *report_json_serializer_serialize_system_cpu_usage_report(struct system_usage_report *report); /** - * @brief Serializes process_memory_usage_report to json string + * @brief Serializes process_usage_report to json string * * @param[in] report Report structure with usage data. * * @return dynamically allocated string on NULL on error. * @remark returned value should be released with @free */ -char *report_json_serializer_serialize_process_cpu_usage_report(struct process_cpu_usage_report *report); +char *report_json_serializer_serialize_process_cpu_usage_report(struct process_usage_report *report); /** - * @brief Serializes process_memory_usage_report to json string + * @brief Serializes process_usage_report to json string * * @param[in] report Report structure with usage data. * * @return dynamically allocated string on NULL on error. * @remark returned value should be released with @free */ -char *report_json_serializer_serialize_process_memory_usage_report(struct process_memory_usage_report *report); +char *report_json_serializer_serialize_process_memory_usage_report(struct process_usage_report *report); /** * @brief Serializes app_system_cpu_usage_report to json string diff --git a/src/report.h b/src/report.h index 2f59c1b..af19094 100644 --- a/src/report.h +++ b/src/report.h @@ -40,29 +40,20 @@ struct system_usage_report { }; /** - * @brief Process CPU usage report. + * @brief Process usage report. */ -struct process_cpu_usage_report { +struct process_usage_report { time_t time; /** Number of seconds after the Epoch */ int pid; /** Process Pid */ float usage; /** CPU utilization of process (Percent) */ }; /** - * @brief Process memory usage report. - */ -struct process_memory_usage_report { - time_t time; /** Number of seconds after the Epoch */ - int pid; /** Process Pid */ - float usage; /** System's memory utilization of process (Percent) */ -}; - -/** * @brief Application CPU usage report. */ struct app_cpu_usage_report { char app_id[APP_ID_MAX_SIZE]; - struct process_cpu_usage_report process_report; + struct process_usage_report process_report; }; /** @@ -70,7 +61,7 @@ struct app_cpu_usage_report { */ struct app_memory_usage_report { char app_id[APP_ID_MAX_SIZE]; - struct process_memory_usage_report process_report; + struct process_usage_report process_report; }; #endif |