2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
8 * http://floralicense.org/license/
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.
20 #include <json-glib/json-glib.h>
23 * @brief The process structure.
25 * @note Do not read fields directly, the struct
26 * is only available publicly to allow easy copy semantic
33 unsigned long long total_ticks_used;
34 unsigned long long frame_ticks_used;
37 float frame_time_inverted;
41 * @brief Initialize process module.
46 * @brief Gets last read process memory usage
48 * @param[in]: proc process
49 * @param[out]: used the memory usage in KiB
51 * @return 0 on success, other value on error.
53 int process_get_memory_usage(struct process *proc, int *used);
56 * @brief Gets last read process CPU usage
58 * @param[in]: proc process
59 * @param[out]: usage CPU usage in clock ticks
61 * @return 0 on success, other value on error.
63 int process_get_cpu_usage(struct process *proc, unsigned long long *usage);
66 * @brief Updates process memory & CPU usage data.
68 * @param[in]: proc process
70 * @return 0 on success, other value on error.
72 int process_update(struct process *proc);
75 * @brief Initializes process structure
78 * @param[in]: proc process
80 * @return 0 on success, other value on error.
82 void process_init_process(int pid, struct process *proc);
85 * @brief Shutdown process structure
87 * @param[in]: proc process
89 * @return 0 on success, other value on error.
91 * @note the structure should be initialized with @process_init, @process_move
93 void process_shutdown(struct process *proc);
96 * @brief Get process pid
98 * @param[in]: proc process
102 int process_get_pid(const struct process *proc);
105 * @brief Get process application id.
107 * @param[in]: proc process
109 * @return: appid or NULL if process is not an Tizen Application.
111 const char *process_get_appid(struct process *proc);
114 * @brief Pathname of executed command.
116 * @param[in]: proc process
118 * @return: exe file path or NULL in case of error.
120 const char *process_get_exe(struct process *proc);
123 * @brief Moves process data from one struct to another.
125 * @param[in]: dst destination process
126 * @param[in]: src source process
128 void process_move(struct process *dst, struct process *src);
131 * @brief Gets average CPU usage percentage since last update.
133 * @param[in]: proc process
134 * @param[out]: usage the cpu usage percentage
136 * @return 0 on success, other value on error.
138 int process_get_cpu_usage_percentage(struct process *proc, float *usage);
141 * @brief Gets average memory usage percentage on last update.
143 * @param[in]: proc process
144 * @param[out]: usage the memory usage percentage
146 * @return 0 on success, other value on error.
148 int process_get_memory_usage_percentage(struct process *dst, float *usage);
151 * @brief Serializes process object as json
153 * @param[in]: proc process
154 * @param[in/out]: the json builder object.
156 void process_serialize(struct process *dst, JsonBuilder *builer);