report-json-serializer: app and top serializers
[apps/native/ttsd-worker-task.git] / src / report.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __REPORT_H_
18 #define __REPORT_H_
19
20 #include <time.h>
21
22 #define APP_ID_MAX_SIZE 256
23
24 /**
25  * @brief Load average report
26  */
27 struct system_load_average_report {
28         time_t time;           /** Number of seconds after the Epoch */
29         float one_min_avg;     /** One minute load averate */
30         float five_min_avg;    /** Five minutes load average */
31         float fifteen_min_avg; /** Fifteen minutes load average */
32 };
33
34 /**
35  * @brief System Memory usage report
36  */
37 struct system_memory_usage_report {
38         time_t time; /** Number of seconds after the Epoch */
39         float usage; /** Memory utilization (Percent) */
40 };
41
42 /**
43  * @brief System CPU usage report
44  */
45 struct system_cpu_usage_report {
46         time_t time; /** Number of seconds after the Epoch */
47         float usage; /** Cpu utilization (Percent) */
48 };
49
50 /**
51  * @brief System CPU usage report per core.
52  */
53 struct system_percpu_usage_report {
54         time_t time;              /** Number of seconds after the Epoch */
55         unsigned int cpu_count;   /** Number of logical cpus (cores) */
56         float usage[];            /** Utilization of each logical cpu (core) */
57 };
58
59 /**
60  * @brief Process CPU usage report.
61  */
62 struct process_cpu_usage_report {
63         time_t time; /** Number of seconds after the Epoch */
64         int pid;     /** Process Pid */
65         float usage; /** CPU utilization of process (Percent) */
66 };
67
68 /**
69  * @brief Process memory usage report.
70  */
71 struct process_memory_usage_report {
72         time_t time;       /** Number of seconds after the Epoch */
73         int pid;           /** Process Pid */
74         float usage;       /** System's memory utilization of process (Percent) */
75 };
76
77 /**
78  * @brief Application CPU usage report.
79  */
80 struct app_cpu_usage_report {
81         char app_id[APP_ID_MAX_SIZE];
82         struct process_cpu_usage_report process_report;
83 };
84
85 /**
86  * @brief Application memory usage report.
87  */
88 struct app_memory_usage_report {
89         char app_id[APP_ID_MAX_SIZE];
90         struct process_memory_usage_report process_report;
91 };
92
93 #endif
94