int report_generator_generate_system_cpu_usage_report(
report_generator_system_t *generator,
int interval,
- struct system_cpu_usage_report *report)
+ struct system_usage_report *report)
{
ON_NULL_RETURN_VAL(generator, -1);
ON_TRUE_RETURN_VAL(interval < 0, -1);
int report_generator_generate_system_memory_usage_report(
report_generator_system_t *generator,
- struct system_memory_usage_report *report) {
+ struct system_usage_report *report) {
ON_NULL_RETURN_VAL(generator, -1);
ON_NULL_RETURN_VAL(report, -1);
void report_generator_free_top_generator(report_generator_top_t *generator);
/**
- * @brief Fills system_cpu_usage_report.
+ * @brief Fills system_usage_report.
*
* When interval > 0 the function will block for interval seconds and return report with
* system cpu usage calculated as average during interval period.
int report_generator_generate_system_cpu_usage_report(
report_generator_system_t *generator,
int interval,
- struct system_cpu_usage_report *report);
+ struct system_usage_report *report);
/**
- * @brief Fills system_memory_usage_report.
+ * @brief Fills system_usage_report.
*
* @param[in] generator system generator
* @param[out] report
*/
int report_generator_generate_system_memory_usage_report(
report_generator_system_t *generator,
- struct system_memory_usage_report *report);
+ struct system_usage_report *report);
/**
* @brief Fills process_cpu_usage_report.
json_builder_end_object(builder);
}
-static void system_memory_usage_report_to_json_object(JsonBuilder *builder, struct system_memory_usage_report *report)
+static void system_memory_usage_report_to_json_object(JsonBuilder *builder, struct system_usage_report *report)
{
json_builder_begin_object(builder);
json_builder_end_object(builder);
}
-static void system_cpu_usage_report_to_json_object(JsonBuilder *builder, struct system_cpu_usage_report *report)
+static void system_cpu_usage_report_to_json_object(JsonBuilder *builder, struct system_usage_report *report)
{
json_builder_begin_object(builder);
IMPLEMENT_SERIALIZER_FUNC(
report_json_serializer_serialize_system_memory_usage_report,
- struct system_memory_usage_report,
+ struct system_usage_report,
system_memory_usage_report_to_json_object)
IMPLEMENT_SERIALIZER_FUNC(
report_json_serializer_serialize_system_cpu_usage_report,
- struct system_cpu_usage_report,
+ struct system_usage_report,
system_cpu_usage_report_to_json_object)
IMPLEMENT_SERIALIZER_FUNC(
char *report_json_serializer_serialize_system_load_average_report(struct system_load_average_report *report);
/**
- * @brief Serializes system_memory_usage_report to json string
+ * @brief Serializes system_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_system_memory_usage_report(struct system_memory_usage_report *report);
+char *report_json_serializer_serialize_system_memory_usage_report(struct system_usage_report *report);
/**
- * @brief Serializes system_cpus_usage_report to json string
+ * @brief Serializes system_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_system_cpu_usage_report(struct system_cpu_usage_report *report);
+char *report_json_serializer_serialize_system_cpu_usage_report(struct system_usage_report *report);
/**
* @brief Serializes process_memory_usage_report to json string
};
/**
- * @brief System Memory usage report
+ * @brief System usage report
*/
-struct system_memory_usage_report {
+struct system_usage_report {
time_t time; /** Number of seconds after the Epoch */
float usage; /** Memory utilization (Percent) */
};
/**
- * @brief System CPU usage report
- */
-struct system_cpu_usage_report {
- time_t time; /** Number of seconds after the Epoch */
- float usage; /** Cpu utilization (Percent) */
-};
-
-/**
* @brief Process CPU usage report.
*/
struct process_cpu_usage_report {
system_task_t *_system_task = container_of(task, system_task_t, task);
- struct system_memory_usage_report report;
+ struct system_usage_report report;
int ret = report_generator_generate_system_memory_usage_report(_system_task->report_generator, &report);
ON_TRUE_RETURN(ret != 0);
system_task_t *_system_task = container_of(task, system_task_t, task);
- struct system_cpu_usage_report report;
+ struct system_usage_report report;
int ret = report_generator_generate_system_cpu_usage_report(_system_task->report_generator, 0, &report);
ON_TRUE_RETURN(ret != 0);